AtoumBundle
AtoumBundle copied to clipboard
Ability to lauch test from another SF2 env rather than "test"
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"
:+1:
:+1:
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:
- if the user provides nothing, the default value
testis used - if the user provides a value with the
--kernel-envCLI argument, its value is used - if the user provides a value with the
environmentoption of therequestmethod, its value is used. If the--kernel-envargument was used, its value is overridden by theenvironmentoption.
excellent !
since then atoum/atoum#310 is merged ! :+1:
thanks to you
:tada:
@omansour @KuiKui seems good to me but I would like to get some reviews from others. I'll then merge everything ;)
Good job @jubianchi ;)
@KuiKui @omansour would you mind testing this branch with a real project to confirm that everything works as expected ?
Thanks :kiss:
On va mettre ça en place oui :smile: Par contre, ça risque de prendre quelques jours (surtout avec le Forum PHP au milieu).
@KuiKui aucun soucis ;) si ça vous va, ça me va aussi