SlideLayoutTest.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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;
  18. use PhpOffice\PhpPresentation\Slide\SlideLayout;
  19. /**
  20. * Test class for PhpPresentation
  21. *
  22. * @coversDefaultClass PhpOffice\PhpPresentation\Slide\SlideLayout
  23. */
  24. class SlideLayoutTest extends \PHPUnit_Framework_TestCase
  25. {
  26. public function testBase()
  27. {
  28. $mockSlideMaster = $this->getMockForAbstractClass('PhpOffice\PhpPresentation\Slide\SlideMaster');
  29. $object = new SlideLayout($mockSlideMaster);
  30. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $object);
  31. $this->assertInstanceOf('\\ArrayObject', $object->getShapeCollection());
  32. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->colorMap);
  33. }
  34. public function testLayoutName()
  35. {
  36. // Mocks
  37. $mockSlideMaster = $this->getMockForAbstractClass('PhpOffice\PhpPresentation\Slide\SlideMaster');
  38. // Expected
  39. $expectedLayoutName = 'Title'.rand(1, 100);
  40. $object = new SlideLayout($mockSlideMaster);
  41. $this->assertNull($object->getLayoutName());
  42. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideLayout', $object->setLayoutName($expectedLayoutName));
  43. $this->assertEquals($expectedLayoutName, $object->getLayoutName());
  44. }
  45. public function testSlideMaster()
  46. {
  47. // Mocks
  48. $mockSlideMaster = $this->getMockForAbstractClass('PhpOffice\PhpPresentation\Slide\SlideMaster');
  49. $object = new SlideLayout($mockSlideMaster);
  50. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideMaster', $object->getSlideMaster());
  51. }
  52. }