Skip to content

Commit cd13080

Browse files
committed
Added fixture example
1 parent 1b55b9d commit cd13080

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,39 @@ class AppKernel extends TestKernel
8989

9090
}
9191
````
92+
93+
Performing functional tests
94+
---------------------------
95+
96+
The testing component provides a base test class which makes it easy
97+
to load DataFixtures and access different types of object managers.
98+
99+
100+
````php
101+
<?php
102+
103+
namespace Symfony\Cmf\Bundle\MenuBundle\Tests\Functional\Admin\MenuNodeAdminTest;
104+
105+
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase;
106+
107+
class MenuNodeAdminTest extends BaseTestCase
108+
{
109+
public function setUp()
110+
{
111+
$this->db('PHPCR')->loadFixtures(array(
112+
'Symfony\Cmf\Bundle\MenuBundle\Tests\Functional\DataFixtures\PHPCR\LoadMenuData',
113+
));
114+
$this->client = $this->createClient();
115+
}
116+
117+
public function testDashboard()
118+
{
119+
$crawler = $this->client->request('GET', '/admin/dashboard');
120+
$res = $this->client->getResponse();
121+
$this->assertEquals(200, $res->getStatusCode());
122+
$this->assertCount(1, $crawler->filter('html:contains("dashboard.label_menu_node")'));
123+
124+
$this->db('PHPCR')->getOm(); // get the document/entity (or object) manager
125+
}
126+
}
127+
````

0 commit comments

Comments
 (0)