Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jubianchi
Copy link
Member

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
Copy link

KuiKui commented Nov 6, 2013

👍

1 similar comment
@jubianchi
Copy link
Member

👍

@jubianchi
Copy link
Member

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 test is used
  • if the user provides a value with the --kernel-env CLI argument, its value is used
  • if the user provides a value with the environment option of the request method, its value is used. If the --kernel-env argument was used, its value is overridden by the environment option.

@omansour
Copy link
Author

excellent !

since then atoum/atoum#310 is merged ! 👍

thanks to you

@KuiKui
Copy link

KuiKui commented Nov 15, 2013

🎉

@jubianchi
Copy link
Member

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

@stephpy
Copy link
Member

stephpy commented Nov 15, 2013

Good job @jubianchi ;)

@jubianchi
Copy link
Member

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

Thanks 💋

@KuiKui
Copy link

KuiKui commented Nov 19, 2013

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

@jubianchi
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants