Hoa central
NoRewind.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Iterator\Test\Unit;
38 
39 use Hoa\Iterator as LUT;
40 use Hoa\Test;
41 
51 {
52  public function case_classic()
53  {
54  $this
55  ->given(
56  $dummyArray = ['f', 'o', 'o', 'b', 'a', 'r'],
57  $iterator = new LUT\Map($dummyArray),
58  $norewind = new LUT\NoRewind($iterator)
59  )
60  ->when($result = iterator_to_array($norewind))
61  ->then
62  ->array($result)
63  ->isEqualTo($dummyArray)
64 
65  ->when($norewind->rewind())
66  ->boolean($norewind->valid())
67  ->isFalse()
68 
69  ->when($result = iterator_to_array($norewind))
70  ->then
71  ->array($result)
72  ->isEmpty();
73  }
74 }