1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the CSDataGridBundle package.
5
+ *
6
+ * (c) Pierre du Plessis <[email protected] >
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace CS \DataGridBundle \Tests \Grid \Column ;
13
+
14
+ use CS \DataGridBundle \Grid \Column \Column ;
15
+ use CS \DataGridBundle \Grid \Column \ColumnCollection ;
16
+
17
+ class ColumnCollectionTest extends \PHPUnit_Framework_TestCase {
18
+
19
+ protected $ stack ;
20
+
21
+ public function setUp ()
22
+ {
23
+ $ this ->collection = new ColumnCollection ;
24
+
25
+ $ this ->collection ->addRecursive (array ('foo ' , 'bar ' , 'baz ' ));
26
+ }
27
+
28
+ public function testCollection ()
29
+ {
30
+ $ elements = $ this ->collection ->all ();
31
+
32
+ $ this ->assertCount (3 , $ elements );
33
+
34
+ unset($ elements );
35
+
36
+ $ this ->assertTrue ($ this ->collection ->has ('foo ' ));
37
+ $ this ->assertTrue ($ this ->collection ->has ('bar ' ));
38
+ $ this ->assertTrue ($ this ->collection ->has ('baz ' ));
39
+
40
+ $ this ->assertInstanceOf ('CS\DataGridBundle\Grid\Column\ColumnInterface ' , $ this ->collection ->get ('foo ' ));
41
+ $ this ->assertInstanceOf ('CS\DataGridBundle\Grid\Column\ColumnInterface ' , $ this ->collection ->get ('bar ' ));
42
+ $ this ->assertInstanceOf ('CS\DataGridBundle\Grid\Column\ColumnInterface ' , $ this ->collection ->get ('baz ' ));
43
+
44
+ $ this ->collection ->remove ('bar ' );
45
+
46
+ $ elements = $ this ->collection ->all ();
47
+
48
+ $ this ->assertCount (2 , $ elements );
49
+ $ this ->assertFalse ($ this ->collection ->has ('bar ' ));
50
+ }
51
+ }
0 commit comments