Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Mar 13, 2024
1 parent f16bbb1 commit 446cf8a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ APP_SECRET=71ffdbd268239ee496cb471d1dfd800f
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
DATABASE_URL="pgsql://postgres:password@localhost/workflow?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
2 changes: 1 addition & 1 deletion src/Controller/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Workflow\Exception\ExceptionInterface;
use Symfony\Component\Workflow\WorkflowInterface;

#[Route(path: '/article')]
#[Route(path: '/articles')]
class ArticleController extends AbstractController
{
public function __construct(
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\Workflow\Exception\ExceptionInterface;
use Symfony\Component\Workflow\WorkflowInterface;

#[Route(path: '/task')]
#[Route(path: '/tasks')]
class TaskController extends AbstractController
{
public function __construct(
Expand All @@ -22,7 +22,7 @@ public function __construct(
private readonly WorkflowInterface $stateMachine,
) {}

#[Route(path: '/', name: 'task_index')]
#[Route(path: '', name: 'task_index')]
public function index(): Response
{
return $this->render('task/index.html.twig', [
Expand Down
18 changes: 0 additions & 18 deletions tests/Controller/HomepageControllerTest.php

This file was deleted.

28 changes: 28 additions & 0 deletions tests/Controller/SmokeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class SmokeTest extends WebTestCase
{
public static function providePages(): iterable
{
yield ['/', 'symfony/workflow', '.container-fluid h1'];
yield ['/tasks'];
yield ['/articles'];
}

/** @dataProvider providePages */
public function test(string $page, ?string $expected = null, ?string $selector = null): void
{
$client = static::createClient();

$crawler = $client->request('GET', $page);

$this->assertEquals(200, $client->getResponse()->getStatusCode());
if ($expected && $selector) {
$this->assertStringContainsString($expected, $crawler->filter($selector)->text());
}
}
}

0 comments on commit 446cf8a

Please sign in to comment.