Hoa central
Public Member Functions | Static Private Attributes | List of all members
Hoa\Iterator\Test\Unit\Limit Class Reference
Inheritance diagram for Hoa\Iterator\Test\Unit\Limit:

Public Member Functions

 case_classic ()
 
 case_negative_offset ()
 
 case_empty ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Static Private Attributes

static $_dummyArray = ['f', 'o', 'o', 'b', 'a', 'r']
 

Detailed Description

Class .

Test suite of the limit iterator.

Definition at line 50 of file Limit.php.

Member Function Documentation

Hoa\Iterator\Test\Unit\Limit::case_classic ( )

Definition at line 56 of file Limit.php.

57  {
58  $this
59  ->given(
60  $iterator = new LUT\Map(self::$_dummyArray),
61  $limit = new LUT\Limit($iterator, 2, 3)
62  )
63  ->when($result = iterator_to_array($limit))
64  ->then
65  ->array($result)
66  ->isEqualTo([
67  2 => 'o',
68  3 => 'b',
69  4 => 'a'
70  ]);
71  }
Hoa\Iterator\Test\Unit\Limit::case_empty ( )

Definition at line 83 of file Limit.php.

84  {
85  $this
86  ->given(
87  $iterator = new LUT\Map(self::$_dummyArray),
88  $limit = new LUT\Limit($iterator, 0, 0)
89  )
90  ->exception(function () use ($limit) {
91  iterator_to_array($limit);
92  })
93  ->isInstanceOf('OutOfBoundsException');
94  }
Hoa\Iterator\Test\Unit\Limit::case_negative_offset ( )

Definition at line 73 of file Limit.php.

74  {
75  $this
76  ->given($iterator = new LUT\Map(self::$_dummyArray))
77  ->exception(function () use ($iterator) {
78  new LUT\Limit($iterator, -2, 3);
79  })
80  ->isInstanceOf('OutOfRangeException');
81  }

Member Data Documentation

Hoa\Iterator\Test\Unit\Limit::$_dummyArray = ['f', 'o', 'o', 'b', 'a', 'r']
staticprivate

Definition at line 52 of file Limit.php.


The documentation for this class was generated from the following file: