Functional testing and continuous integration with GitLab

Viewed 393

I usually use GitLab to host my repositories and to use their CI/CD. I made a Symfony project (PHP) with some code. I know how to configure my .gitlab-ci.yml to execute my unit tests through PHPUnit.

But I don't really understand how to execute my functional test. For example this code is just testing that the route /login is reachable and not return a 500.

class SecurityControllerTest extends WebTestCase
{
    public function testLogin()
    {
        $client = static::createClient();
        $client->request('GET', '/login');
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
    }
}

So I assume that apache/nginx is needed to interpret PHP. So do I have to make a real docker-compose with a complete LAMP stack or is there a better way?

1 Answers

Functional tests are executed directly in phpunit. You only need to install browser-kit and dom-crawler symfony components.

If you use an ORM, you have to declare a database image as a service and initialize your database in your CI script.

Related