mardi 3 novembre 2015

change ENV on the fly in a phpunit test

In a phpunit test on a Lumen 5.1 , I want to change my env from "testing" to "local"

/**
 * @test
 * @group storage
 */
public function flush()
{
    $this->app->bind('env', 'local');
    echo ($this->app['env']);
    $this->redis->flushDb(TenStorage::MAIN_DB);

}

but when i run it, I get the error:

There was 1 error:

1) App\AppStorage\StorageTest::flush
ReflectionException: Class local does not exist

how can i temporarily change my ENV from testing to local?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire