1 | <?php |
||
19 | class CollectionSnapshotTest extends PHPUnit_Framework_TestCase |
||
20 | { |
||
21 | /** |
||
22 | * @expectedException InvalidArgumentException |
||
23 | * @expectedExceptionMessage An array or a Traversable was expected to take a snapshot of a collection, "string" given |
||
24 | */ |
||
25 | public function testSnapshotNotArray() |
||
29 | |||
30 | /** |
||
31 | * @expectedException InvalidArgumentException |
||
32 | * @expectedExceptionMessage The snapshot class "Totem\Fubar" does not seem to be loadable |
||
33 | */ |
||
34 | public function testSnapshotClassNotLoadable() |
||
38 | |||
39 | /** |
||
40 | * @dataProvider snapshotClassWrongReflectionProvider |
||
41 | * |
||
42 | * @expectedException InvalidArgumentException |
||
43 | * @expectedExceptionMessage A Snapshot Class should be instantiable and extends abstract class Totem\AbstractSnapshot |
||
44 | */ |
||
45 | public function testSnapshotWrongReflection($class) |
||
49 | |||
50 | public function snapshotClassWrongReflectionProvider() |
||
55 | |||
56 | /** |
||
57 | * @expectedException InvalidArgumentException |
||
58 | * @expectedExceptionMessage The given array / Traversable is not a collection as it contains non numeric keys |
||
59 | */ |
||
60 | public function testNonCollection() |
||
64 | |||
65 | /** |
||
66 | * @expectedException InvalidArgumentException |
||
67 | * @expectedExceptionMessage The key "baz" is not defined or readable in one of the elements of the collection |
||
68 | */ |
||
69 | public function testKeyNotReadable() |
||
73 | |||
74 | /** @dataProvider allValidProvider */ |
||
75 | public function testAllValid($hasSnapshot) |
||
93 | |||
94 | public function allValidProvider() |
||
99 | |||
100 | /** |
||
101 | * @expectedException InvalidArgumentException |
||
102 | * @expectedExceptionMessage The primary key "baz" is not in the computed dataset |
||
103 | */ |
||
104 | public function testOriginalKeyNotFound() |
||
109 | |||
110 | public function testOriginalKey() |
||
116 | } |
||
117 | |||
118 |