Your IP : 216.73.217.79


Current Path : /var/www/v3.cesa.co.za/tests/CoreBundle/Controller/
Upload File :
Current File : /var/www/v3.cesa.co.za/tests/CoreBundle/Controller/DefaultControllerTest.php

<?php

namespace App\Tests\CoreBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DefaultControllerTest extends WebTestCase
{
    public function testIndexAction(): void
    {
        // Create a client to make requests
        $client = static::createClient();

        // Make a request to the home page
        $crawler = $client->request('GET', '/');

        // Assert that the response is successful
        $this->assertResponseIsSuccessful();

        // Assert that we get a 200 status code
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
    }

    public function testIndexActionReturnsCorrectTemplate(): void
    {
        // Create a client to make requests
        $client = static::createClient();

        // Make a request to the home page
        $crawler = $client->request('GET', '/');

        // Assert that the response is successful
        $this->assertResponseIsSuccessful();

        // The response should contain content from the template
        $this->assertNotEmpty($client->getResponse()->getContent());
    }

    public function testIndexActionWithServiceGetterManager(): void
    {
        // Create a client to make requests
        $client = static::createClient();

        // Make a request to the home page
        $crawler = $client->request('GET', '/');

        // Assert that the response is successful
        $this->assertResponseIsSuccessful();

        // Assert that we get a valid response
        $this->assertInstanceOf(\Symfony\Component\HttpFoundation\Response::class, $client->getResponse());
    }
}