|
5 | 5 |
|
6 | 6 | use <?= $entity_full_class_name ?>;
|
7 | 7 | use Doctrine\ORM\EntityManager;
|
8 |
| -use Symfony\Bundle\FrameworkBundle\KernelBrowser; |
9 | 8 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
10 | 9 |
|
11 | 10 | class <?= $class_name ?> extends WebTestCase<?= "\n" ?>
|
12 | 11 | {
|
13 |
| - private static ?KernelBrowser $client = null; |
14 |
| - |
15 |
| - private ?EntityManager $entityManager; |
16 |
| - |
17 |
| - protected function setUp(): void |
| 12 | + public function testIndex(): void |
18 | 13 | {
|
19 |
| - if (null === self::$client) { |
20 |
| - self::$client = static::createClient(); |
21 |
| - } |
| 14 | + $client = static::createClient(); |
22 | 15 |
|
23 |
| - $kernel = self::bootKernel(); |
24 |
| - |
25 |
| - $this->entityManager = $kernel->getContainer() |
26 |
| - ->get('doctrine') |
27 |
| - ->getManager(); |
28 |
| - } |
29 |
| - |
30 |
| - public function testIndex() |
31 |
| - { |
32 |
| - $client = self::$client; |
33 | 16 | $crawler = $client->request('GET', '<?= $route_path ?>/');
|
34 | 17 |
|
35 |
| - $this->assertSame(200, $client->getResponse()->getStatusCode()); |
36 |
| - $this->assertContains('<!DOCTYPE html>', $client->getResponse()->getContent()); |
37 |
| - $this->assertContains('<?= $entity_class_name ?> index', $crawler->filter('h1')->text()); |
| 18 | + self::assertResponseStatusCodeSame(200); |
| 19 | + self::assertPageTitleContains('SweetFood index'); |
38 | 20 | }
|
39 | 21 |
|
40 | 22 | /**
|
41 | 23 | * @TODO implement new test
|
42 | 24 | */
|
43 | 25 | public function testNew()
|
44 | 26 | {
|
| 27 | + $this->markTestIncomplete(); |
45 | 28 | $client = self::$client;
|
46 | 29 | $crawler = $client->request('GET', '<?= $route_path ?>/');
|
47 | 30 | $newLink = $crawler->filter('a:contains("Create new")')->eq(0)->link();
|
@@ -184,12 +167,4 @@ public function testNew()
|
184 | 167 | // $this->assertNotContains('Delete ipsum', $client->getResponse()->getContent());
|
185 | 168 | <?php endif; ?>
|
186 | 169 | // }
|
187 |
| - |
188 |
| - protected function tearDown(): void |
189 |
| - { |
190 |
| - parent::tearDown(); |
191 |
| - |
192 |
| - $this->entityManager->close(); |
193 |
| - $this->entityManager = null; |
194 |
| - } |
195 | 170 | }
|
0 commit comments