Skip to content
Snippets Groups Projects
Commit ea61b673 authored by ZZZ[GONE] PERRIER Guillaume's avatar ZZZ[GONE] PERRIER Guillaume
Browse files

[DEFAULT] Home page test implementation.

parent da7cf3f9
No related branches found
No related tags found
1 merge request!6[PHP-UNIT] Complete performing CI test within the container and use it for...
Pipeline #232948 passed
......@@ -63,7 +63,11 @@
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
......
<?php
namespace App\Tests\Controller;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testHomepage()
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
//======================== 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.");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment