Skip to content
This repository was archived by the owner on Jun 10, 2022. It is now read-only.

Commit 8dbbd55

Browse files
committed
Added tests for ColumnCollection
1 parent 810e580 commit 8dbbd55

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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

Comments
 (0)