IteratorTest.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\Slide;
  18. use PhpOffice\PhpPresentation\PhpPresentation;
  19. use PhpOffice\PhpPresentation\Slide;
  20. use PhpOffice\PhpPresentation\Slide\Iterator;
  21. /**
  22. * Test class for IOFactory
  23. *
  24. * @coversDefaultClass PhpOffice\PhpPresentation\IOFactory
  25. */
  26. class IteratorTest extends \PHPUnit_Framework_TestCase
  27. {
  28. /**
  29. */
  30. public function testMethod()
  31. {
  32. $oPhpPresentation = new PhpPresentation();
  33. $oPhpPresentation->addSlide(new Slide());
  34. $object = new Iterator($oPhpPresentation);
  35. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current());
  36. $this->assertEquals(0, $object->key());
  37. $this->assertNull($object->next());
  38. $this->assertEquals(1, $object->key());
  39. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current());
  40. $this->assertTrue($object->valid());
  41. $this->assertNull($object->next());
  42. $this->assertFalse($object->valid());
  43. $this->assertNull($object->rewind());
  44. $this->assertEquals(0, $object->key());
  45. }
  46. }