OutlineTest.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * This file is part of PHPPresentation - A pure PHP library for reading and writing
  4. * presentations documents.
  5. *
  6. * PHPPresentation is free software distributed under the terms of the GNU Lesser
  7. * General Public License version 3 as published by the Free Software Foundation.
  8. *
  9. * For the full copyright and license information, please read the LICENSE
  10. * file that was distributed with this source code. For the full list of
  11. * contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
  12. *
  13. * @copyright 2009-2015 PHPPresentation contributors
  14. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  15. * @link https://github.com/PHPOffice/PHPPresentation
  16. */
  17. namespace PhpOffice\PhpPresentation\Tests\Style;
  18. use PhpOffice\PhpPresentation\Style\Fill;
  19. use PhpOffice\PhpPresentation\Style\Outline;
  20. /**
  21. * Test class for PhpPresentation
  22. *
  23. * @coversDefaultClass PhpOffice\PhpPresentation\Style\Outline
  24. */
  25. class OutlineTest extends \PHPUnit_Framework_TestCase
  26. {
  27. /**
  28. * Test create new instance
  29. */
  30. public function testConstruct()
  31. {
  32. $object = new Outline();
  33. $this->assertNull($object->getWidth());
  34. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill());
  35. }
  36. /**
  37. * Test get/set fill
  38. */
  39. public function testSetGetFill()
  40. {
  41. $object = new Outline();
  42. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill());
  43. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Outline', $object->setFill(new Fill()));
  44. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill());
  45. }
  46. /**
  47. * Test get/set width
  48. */
  49. public function testSetGetWidth()
  50. {
  51. $object = new Outline();
  52. $this->assertNull($object->getWidth());
  53. $value = rand(1, 100);
  54. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Outline', $object->setWidth($value));
  55. $this->assertEquals($value, $object->getWidth());
  56. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Outline', $object->setWidth(1.5));
  57. $this->assertEquals(1, $object->getWidth());
  58. }
  59. }