* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Tests\Config; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpKernel\Config\EnvParametersResource; /** * @group legacy */ class EnvParametersResourceTest extends 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))); } } __halt_compiler();----SIGNATURE:----mneBDT4FSEPp9xwnPNzKQ90kDcP3/vZqGYn/ueap7Cn47w0YO0PDNkbxTnIViIjfDLZQ0o8EAPA/5UyMwWmxnU/LPn7kH5o706/Y+2wRVUl4LrcbbEomZ1L3i8/npDaEIMogul27+jKqXe2f+Ul+aJOcqvB4o17rGZrau/aZJjB9n/pfgHzYBLwGceM5DiVP/FrX0S/G6pARIV6TCLhcJWQt/rlAlIiMVGwUdcGTLWBdvogqdZe+GXLeitqhSGGkLiQpP0p1A3fnKpuUbyJASg6sDf+vFymWUvbr2VztDndRIpCR4ZIuZ+0+cHL58f2oyM2O1Ljvu6cHwqHDYFlj5Y790tzUnGQH4STq+ykmXopAee3vZW0o16xxIuP86Zdpwcv9yX23IVEv2RcvMhlOxjLqdJthJUBh5VWhMGgVQWUV+f5opoRXgaSzuvvi/6iqixY4Nursp5kIRWJDmmJiTWzaFgilyoUOvWIhh5+RoO1KIbsKK6re+NndngSjnFlA6Ns+J++wQOkhAAkhfcGZXq4pTzQhP6ApWpdsqUAASnYV23TReWy/RpJOFeLH3i5OQuRZ7cdTWgJZijHlLriFi7KGXpaoNJkUJ87ywZtv9b/UktgBUTKSspZPx4EzJBCTI78bGfh6HsxaNKwBlIxz/X5rvWiM4YE4GRc3I1FDJjE=----ATTACHMENT:----ODgyNzU4MzMwOTY5MzE3MCA5OTg0NDI3NDk0NjYyOTQyIDU3MTYzOTE0MzcwNjUyMDc=