atoum / AtoumBundle

This bundle provides a simple integration of atoum into Symfony 2.
MIT License
44 stars 25 forks source link

Ability to lauch test from another SF2 env rather than "test" #46

Open omansour opened 11 years ago

omansour commented 11 years ago

pointed by @KuiKui we sometimes uses another environment, like "CI"

but the bundle doesnt allow us to create a test kernel in such environment. We are stucked in "test"

KuiKui commented 11 years ago

:+1:

jubianchi commented 11 years ago

:+1:

jubianchi commented 11 years ago

Here is an implementation of the request feature.

It cannot be merged as is : this patch depends on atoum/atoum#310

It allows to do:

$ app/console atoum AcmeBundle --kernel-env=ci

The default environment is testand if you do not provide the --kernel-env argument, the default will be used.

You will still be able to set the kernel environment at a test level if you want/need:

<?php

namespace vendor\FooBundle\Tests\Controller;

use atoum\AtoumBundle\Test\Units\WebTestCase;
use atoum\AtoumBundle\Test\Controller\ControllerTest;

class BarController extends ControllerTest
{
    public function testGet()
    {
        $this
            ->request(array('debug' => true, 'environment' => 'ci'))
                ->GET('/demo/' . uniqid())
                    ->hasStatus(404)
                    ->hasCharset('UTF-8')
                    ->hasVersion('1.1')
                    //...
        ;
    }
}

Here are how the environment is selected:

omansour commented 11 years ago

excellent !

since then atoum/atoum#310 is merged ! :+1:

thanks to you

KuiKui commented 11 years ago

:tada:

jubianchi commented 11 years ago

@omansour @KuiKui seems good to me but I would like to get some reviews from others. I'll then merge everything ;)

stephpy commented 11 years ago

Good job @jubianchi ;)

jubianchi commented 11 years ago

@KuiKui @omansour would you mind testing this branch with a real project to confirm that everything works as expected ?

Thanks :kiss:

KuiKui commented 11 years ago

On va mettre ça en place oui :smile: Par contre, ça risque de prendre quelques jours (surtout avec le Forum PHP au milieu).

jubianchi commented 11 years ago

@KuiKui aucun soucis ;) si ça vous va, ça me va aussi