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

Commit 810e580

Browse files
committed
Added test for Collection
1 parent 8aa0033 commit 810e580

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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;
13+
14+
use CS\DataGridBundle\Grid\Collection;
15+
16+
class CollectionTest extends \PHPUnit_Framework_TestCase {
17+
18+
protected $stack;
19+
20+
public function setUp()
21+
{
22+
$this->collection = new Collection;
23+
24+
$this->collection->addRecursive(array('foo', 'bar', 'baz'));
25+
}
26+
27+
public function testCollection()
28+
{
29+
$elements = $this->collection->all();
30+
31+
$this->assertCount(3, $elements);
32+
33+
unset($elements);
34+
35+
$this->assertTrue($this->collection->has('foo'));
36+
$this->assertTrue($this->collection->has('bar'));
37+
$this->assertTrue($this->collection->has('baz'));
38+
39+
$this->assertEquals('foo', $this->collection->get('foo'));
40+
$this->assertEquals('bar', $this->collection->get('bar'));
41+
$this->assertEquals('baz', $this->collection->get('baz'));
42+
43+
$this->collection->remove('bar');
44+
45+
$elements = $this->collection->all();
46+
47+
$this->assertCount(2, $elements);
48+
$this->assertFalse($this->collection->has('bar'));
49+
}
50+
}

0 commit comments

Comments
 (0)