Newer
Older
<?php
namespace App\Tests\Controller;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
![ZZZ[GONE] PERRIER Guillaume ZZZ[GONE] PERRIER Guillaume's avatar](/assets/no_avatar-849f9c04a3a0d0cea2424ae97b27447dc64a7dbfae83c036c45b403392f0e8ba.png)
ZZZ[GONE] PERRIER Guillaume
committed
public function setUp(): void
{
parent::setUp();
}
public function testHomepage()
{
![ZZZ[GONE] PERRIER Guillaume ZZZ[GONE] PERRIER Guillaume's avatar](/assets/no_avatar-849f9c04a3a0d0cea2424ae97b27447dc64a7dbfae83c036c45b403392f0e8ba.png)
ZZZ[GONE] PERRIER Guillaume
committed
$client = static::createClient([], ['HTTPS' => true]);
$crawler = $client->request('GET', '/');
![ZZZ[GONE] PERRIER Guillaume ZZZ[GONE] PERRIER Guillaume's avatar](/assets/no_avatar-849f9c04a3a0d0cea2424ae97b27447dc64a7dbfae83c036c45b403392f0e8ba.png)
ZZZ[GONE] PERRIER Guillaume
committed
dd($crawler);
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//======================== TAPES =========================
$tapesCard = $crawler->filter('h2.card-title')->eq(0);
$tapesCardTitle = $tapesCard->html();
$this->assertEquals('Tapes', $tapesCardTitle, "Tapes card was not found.");
$tapesCardNumber = $tapesCard->nextAll()->html();
$this->assertGreaterThan(0, $tapesCardNumber, "There is no tapes found.");
$tapesCanevas = $crawler->filter('#chartServices')->count();
$this->assertEquals(1, $tapesCanevas, "Tapes chart was not found.");
//======================== LIBRARIES =========================
$librariesCard = $crawler->filter('h2.card-title')->eq(1);
$librariesCardTitle = $librariesCard->html();
$this->assertEquals('Librairies', $librariesCardTitle, "Libraries card was not found.");
$librariesCardNumber = $librariesCard->nextAll()->html();
$this->assertGreaterThan(0, $librariesCardNumber, "There is no libraries found.");
$librariesCanevas = $crawler->filter('#chartStatuts')->count();
$this->assertEquals(1, $librariesCanevas, "libraries chart was not found.");
//======================== COMMANDS =========================
$CommandsCard = $crawler->filter('h2.card-title')->eq(2);
$commandsCardTitle = $CommandsCard->html();
$this->assertEquals('Commandes', $commandsCardTitle, "Commands card was not found.");
$commandsCardNumber = $CommandsCard->nextAll()->html();
$this->assertGreaterThan(0, $commandsCardNumber, "There is no commands found.");
$commandsCanevas = $crawler->filter('#chartModels')->count();
$this->assertEquals(1, $commandsCanevas, "Commands chart was not found.");
}
}