class EnvParametersResourceTest in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php \Symfony\Component\HttpKernel\Tests\Config\EnvParametersResourceTest
Hierarchy
- class \Symfony\Component\HttpKernel\Tests\Config\EnvParametersResourceTest extends \Symfony\Component\HttpKernel\Tests\Config\PHPUnit_Framework_TestCase
Expanded class hierarchy of EnvParametersResourceTest
File
- vendor/
symfony/ http-kernel/ Tests/ Config/ EnvParametersResourceTest.php, line 16
Namespace
Symfony\Component\HttpKernel\Tests\ConfigView source
class EnvParametersResourceTest extends \PHPUnit_Framework_TestCase {
protected $prefix = '__DUMMY_';
protected $initialEnv;
protected $resource;
protected function setUp() {
$this->initialEnv = array(
$this->prefix . '1' => 'foo',
$this->prefix . '2' => 'bar',
);
foreach ($this->initialEnv as $key => $value) {
$_SERVER[$key] = $value;
}
$this->resource = new EnvParametersResource($this->prefix);
}
protected function tearDown() {
foreach ($_SERVER as $key => $value) {
if (0 === strpos($key, $this->prefix)) {
unset($_SERVER[$key]);
}
}
}
public function testGetResource() {
$this
->assertSame(array(
'prefix' => $this->prefix,
'variables' => $this->initialEnv,
), $this->resource
->getResource(), '->getResource() returns the resource');
}
public function testToString() {
$this
->assertSame(serialize(array(
'prefix' => $this->prefix,
'variables' => $this->initialEnv,
)), (string) $this->resource);
}
public function testIsFreshNotChanged() {
$this
->assertTrue($this->resource
->isFresh(time()), '->isFresh() returns true if the variables have not changed');
}
public function testIsFreshValueChanged() {
reset($this->initialEnv);
$_SERVER[key($this->initialEnv)] = 'baz';
$this
->assertFalse($this->resource
->isFresh(time()), '->isFresh() returns false if a variable has been changed');
}
public function testIsFreshValueRemoved() {
reset($this->initialEnv);
unset($_SERVER[key($this->initialEnv)]);
$this
->assertFalse($this->resource
->isFresh(time()), '->isFresh() returns false if a variable has been removed');
}
public function testIsFreshValueAdded() {
$_SERVER[$this->prefix . '3'] = 'foo';
$this
->assertFalse($this->resource
->isFresh(time()), '->isFresh() returns false if a variable has been added');
}
public function testSerializeUnserialize() {
$this
->assertEquals($this->resource, unserialize(serialize($this->resource)));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EnvParametersResourceTest:: |
protected | property | ||
EnvParametersResourceTest:: |
protected | property | ||
EnvParametersResourceTest:: |
protected | property | ||
EnvParametersResourceTest:: |
protected | function | ||
EnvParametersResourceTest:: |
protected | function | ||
EnvParametersResourceTest:: |
public | function | ||
EnvParametersResourceTest:: |
public | function | ||
EnvParametersResourceTest:: |
public | function | ||
EnvParametersResourceTest:: |
public | function | ||
EnvParametersResourceTest:: |
public | function | ||
EnvParametersResourceTest:: |
public | function | ||
EnvParametersResourceTest:: |
public | function |