diff options
Diffstat (limited to 'vendor/symfony/config/Symfony/Component/Config/Tests')
39 files changed, 0 insertions, 3345 deletions
diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/ConfigCacheTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/ConfigCacheTest.php deleted file mode 100644 index 8271885..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/ConfigCacheTest.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests; - -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\Config\Resource\FileResource; - -class ConfigCacheTest extends \PHPUnit_Framework_TestCase -{ - private $resourceFile = null; - - private $cacheFile = null; - - private $metaFile = null; - - protected function setUp() - { - $this->resourceFile = tempnam(sys_get_temp_dir(), '_resource'); - $this->cacheFile = tempnam(sys_get_temp_dir(), 'config_'); - $this->metaFile = $this->cacheFile.'.meta'; - - $this->makeCacheFresh(); - $this->generateMetaFile(); - } - - protected function tearDown() - { - $files = array($this->cacheFile, $this->metaFile, $this->resourceFile); - - foreach ($files as $file) { - if (file_exists($file)) { - unlink($file); - } - } - } - - public function testToString() - { - $cache = new ConfigCache($this->cacheFile, true); - - $this->assertSame($this->cacheFile, (string) $cache); - } - - public function testCacheIsNotFreshIfFileDoesNotExist() - { - unlink($this->cacheFile); - - $cache = new ConfigCache($this->cacheFile, false); - - $this->assertFalse($cache->isFresh()); - } - - public function testCacheIsAlwaysFreshIfFileExistsWithDebugDisabled() - { - $this->makeCacheStale(); - - $cache = new ConfigCache($this->cacheFile, false); - - $this->assertTrue($cache->isFresh()); - } - - public function testCacheIsNotFreshWithoutMetaFile() - { - unlink($this->metaFile); - - $cache = new ConfigCache($this->cacheFile, true); - - $this->assertFalse($cache->isFresh()); - } - - public function testCacheIsFreshIfResourceIsFresh() - { - $cache = new ConfigCache($this->cacheFile, true); - - $this->assertTrue($cache->isFresh()); - } - - public function testCacheIsNotFreshIfOneOfTheResourcesIsNotFresh() - { - $this->makeCacheStale(); - - $cache = new ConfigCache($this->cacheFile, true); - - $this->assertFalse($cache->isFresh()); - } - - public function testWriteDumpsFile() - { - unlink($this->cacheFile); - unlink($this->metaFile); - - $cache = new ConfigCache($this->cacheFile, false); - $cache->write('FOOBAR'); - - $this->assertFileExists($this->cacheFile, 'Cache file is created'); - $this->assertSame('FOOBAR', file_get_contents($this->cacheFile)); - $this->assertFileNotExists($this->metaFile, 'Meta file is not created'); - } - - public function testWriteDumpsMetaFileWithDebugEnabled() - { - unlink($this->cacheFile); - unlink($this->metaFile); - - $metadata = array(new FileResource($this->resourceFile)); - - $cache = new ConfigCache($this->cacheFile, true); - $cache->write('FOOBAR', $metadata); - - $this->assertFileExists($this->cacheFile, 'Cache file is created'); - $this->assertFileExists($this->metaFile, 'Meta file is created'); - $this->assertSame(serialize($metadata), file_get_contents($this->metaFile)); - } - - private function makeCacheFresh() - { - touch($this->resourceFile, filemtime($this->cacheFile) - 3600); - } - - private function makeCacheStale() - { - touch($this->cacheFile, filemtime($this->resourceFile) - 3600); - } - - private function generateMetaFile() - { - file_put_contents($this->metaFile, serialize(array(new FileResource($this->resourceFile)))); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php deleted file mode 100644 index 291c2fd..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php +++ /dev/null @@ -1,160 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\ScalarNode; - -class ArrayNodeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException - */ - public function testNormalizeThrowsExceptionWhenFalseIsNotAllowed() - { - $node = new ArrayNode('root'); - $node->normalize(false); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage Unrecognized option "foo" under "root" - */ - public function testExceptionThrownOnUnrecognizedChild() - { - $node = new ArrayNode('root'); - $node->normalize(array('foo' => 'bar')); - } - - /** - * Tests that no exception is thrown for an unrecognized child if the - * ignoreExtraKeys option is set to true. - * - * Related to testExceptionThrownOnUnrecognizedChild - */ - public function testIgnoreExtraKeysNoException() - { - $node = new ArrayNode('roo'); - $node->setIgnoreExtraKeys(true); - - $node->normalize(array('foo' => 'bar')); - $this->assertTrue(true, 'No exception was thrown when setIgnoreExtraKeys is true'); - } - - /** - * @dataProvider getPreNormalizationTests - */ - public function testPreNormalize($denormalized, $normalized) - { - $node = new ArrayNode('foo'); - - $r = new \ReflectionMethod($node, 'preNormalize'); - $r->setAccessible(true); - - $this->assertSame($normalized, $r->invoke($node, $denormalized)); - } - - public function getPreNormalizationTests() - { - return array( - array( - array('foo-bar' => 'foo'), - array('foo_bar' => 'foo'), - ), - array( - array('foo-bar_moo' => 'foo'), - array('foo-bar_moo' => 'foo'), - ), - array( - array('foo-bar' => null, 'foo_bar' => 'foo'), - array('foo-bar' => null, 'foo_bar' => 'foo'), - ), - ); - } - - /** - * @dataProvider getZeroNamedNodeExamplesData - */ - public function testNodeNameCanBeZero($denormalized, $normalized) - { - $zeroNode = new ArrayNode(0); - $zeroNode->addChild(new ScalarNode('name')); - $fiveNode = new ArrayNode(5); - $fiveNode->addChild(new ScalarNode(0)); - $fiveNode->addChild(new ScalarNode('new_key')); - $rootNode = new ArrayNode('root'); - $rootNode->addChild($zeroNode); - $rootNode->addChild($fiveNode); - $rootNode->addChild(new ScalarNode('string_key')); - $r = new \ReflectionMethod($rootNode, 'normalizeValue'); - $r->setAccessible(true); - - $this->assertSame($normalized, $r->invoke($rootNode, $denormalized)); - } - - public function getZeroNamedNodeExamplesData() - { - return array( - array( - array( - 0 => array( - 'name' => 'something', - ), - 5 => array( - 0 => 'this won\'t work too', - 'new_key' => 'some other value', - ), - 'string_key' => 'just value', - ), - array( - 0 => array( - 'name' => 'something', - ), - 5 => array( - 0 => 'this won\'t work too', - 'new_key' => 'some other value', - ), - 'string_key' => 'just value', - ), - ), - ); - } - - /** - * @dataProvider getPreNormalizedNormalizedOrderedData - */ - public function testChildrenOrderIsMaintainedOnNormalizeValue($prenormalized, $normalized) - { - $scalar1 = new ScalarNode('1'); - $scalar2 = new ScalarNode('2'); - $scalar3 = new ScalarNode('3'); - $node = new ArrayNode('foo'); - $node->addChild($scalar1); - $node->addChild($scalar3); - $node->addChild($scalar2); - - $r = new \ReflectionMethod($node, 'normalizeValue'); - $r->setAccessible(true); - - $this->assertSame($normalized, $r->invoke($node, $prenormalized)); - } - - public function getPreNormalizedNormalizedOrderedData() - { - return array( - array( - array('2' => 'two', '1' => 'one', '3' => 'three'), - array('2' => 'two', '1' => 'one', '3' => 'three'), - ), - ); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php deleted file mode 100644 index 0753d64..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\BooleanNode; - -class BooleanNodeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getValidValues - */ - public function testNormalize($value) - { - $node = new BooleanNode('test'); - $this->assertSame($value, $node->normalize($value)); - } - - public function getValidValues() - { - return array( - array(false), - array(true), - ); - } - - /** - * @dataProvider getInvalidValues - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException - */ - public function testNormalizeThrowsExceptionOnInvalidValues($value) - { - $node = new BooleanNode('test'); - $node->normalize($value); - } - - public function getInvalidValues() - { - return array( - array(null), - array(''), - array('foo'), - array(0), - array(1), - array(0.0), - array(0.1), - array(array()), - array(array('foo' => 'bar')), - array(new \stdClass()), - ); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php deleted file mode 100644 index e75ed34..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ /dev/null @@ -1,207 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\Config\Definition\Processor; -use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; -use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; - -class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase -{ - public function testAppendingSomeNode() - { - $parent = new ArrayNodeDefinition('root'); - $child = new ScalarNodeDefinition('child'); - - $parent - ->children() - ->scalarNode('foo')->end() - ->scalarNode('bar')->end() - ->end() - ->append($child); - - $this->assertCount(3, $this->getField($parent, 'children')); - $this->assertTrue(in_array($child, $this->getField($parent, 'children'))); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException - * @dataProvider providePrototypeNodeSpecificCalls - */ - public function testPrototypeNodeSpecificOption($method, $args) - { - $node = new ArrayNodeDefinition('root'); - - call_user_func_array(array($node, $method), $args); - - $node->getNode(); - } - - public function providePrototypeNodeSpecificCalls() - { - return array( - array('defaultValue', array(array())), - array('addDefaultChildrenIfNoneSet', array()), - array('requiresAtLeastOneElement', array()), - array('useAttributeAsKey', array('foo')), - ); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException - */ - public function testConcreteNodeSpecificOption() - { - $node = new ArrayNodeDefinition('root'); - $node - ->addDefaultsIfNotSet() - ->prototype('array') - ; - $node->getNode(); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException - */ - public function testPrototypeNodesCantHaveADefaultValueWhenUsingDefaultChildren() - { - $node = new ArrayNodeDefinition('root'); - $node - ->defaultValue(array()) - ->addDefaultChildrenIfNoneSet('foo') - ->prototype('array') - ; - $node->getNode(); - } - - public function testPrototypedArrayNodeDefaultWhenUsingDefaultChildren() - { - $node = new ArrayNodeDefinition('root'); - $node - ->addDefaultChildrenIfNoneSet() - ->prototype('array') - ; - $tree = $node->getNode(); - $this->assertEquals(array(array()), $tree->getDefaultValue()); - } - - /** - * @dataProvider providePrototypedArrayNodeDefaults - */ - public function testPrototypedArrayNodeDefault($args, $shouldThrowWhenUsingAttrAsKey, $shouldThrowWhenNotUsingAttrAsKey, $defaults) - { - $node = new ArrayNodeDefinition('root'); - $node - ->addDefaultChildrenIfNoneSet($args) - ->prototype('array') - ; - - try { - $tree = $node->getNode(); - $this->assertFalse($shouldThrowWhenNotUsingAttrAsKey); - $this->assertEquals($defaults, $tree->getDefaultValue()); - } catch (InvalidDefinitionException $e) { - $this->assertTrue($shouldThrowWhenNotUsingAttrAsKey); - } - - $node = new ArrayNodeDefinition('root'); - $node - ->useAttributeAsKey('attr') - ->addDefaultChildrenIfNoneSet($args) - ->prototype('array') - ; - - try { - $tree = $node->getNode(); - $this->assertFalse($shouldThrowWhenUsingAttrAsKey); - $this->assertEquals($defaults, $tree->getDefaultValue()); - } catch (InvalidDefinitionException $e) { - $this->assertTrue($shouldThrowWhenUsingAttrAsKey); - } - } - - public function providePrototypedArrayNodeDefaults() - { - return array( - array(null, true, false, array(array())), - array(2, true, false, array(array(), array())), - array('2', false, true, array('2' => array())), - array('foo', false, true, array('foo' => array())), - array(array('foo'), false, true, array('foo' => array())), - array(array('foo', 'bar'), false, true, array('foo' => array(), 'bar' => array())), - ); - } - - public function testNestedPrototypedArrayNodes() - { - $node = new ArrayNodeDefinition('root'); - $node - ->addDefaultChildrenIfNoneSet() - ->prototype('array') - ->prototype('array') - ; - $node->getNode(); - } - - public function testEnabledNodeDefaults() - { - $node = new ArrayNodeDefinition('root'); - $node - ->canBeEnabled() - ->children() - ->scalarNode('foo')->defaultValue('bar')->end() - ; - - $this->assertEquals(array('enabled' => false, 'foo' => 'bar'), $node->getNode()->getDefaultValue()); - } - - /** - * @dataProvider getEnableableNodeFixtures - */ - public function testTrueEnableEnabledNode($expected, $config, $message) - { - $processor = new Processor(); - $node = new ArrayNodeDefinition('root'); - $node - ->canBeEnabled() - ->children() - ->scalarNode('foo')->defaultValue('bar')->end() - ; - - $this->assertEquals( - $expected, - $processor->process($node->getNode(), $config), - $message - ); - } - - public function getEnableableNodeFixtures() - { - return array( - array(array('enabled' => true, 'foo' => 'bar'), array(true), 'true enables an enableable node'), - array(array('enabled' => true, 'foo' => 'bar'), array(null), 'null enables an enableable node'), - array(array('enabled' => true, 'foo' => 'bar'), array(array('enabled' => true)), 'An enableable node can be enabled'), - array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'), - array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'), - array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'), - ); - } - - protected function getField($object, $field) - { - $reflection = new \ReflectionProperty($object, $field); - $reflection->setAccessible(true); - - return $reflection->getValue($object); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php deleted file mode 100644 index 69f7fcf..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\EnumNodeDefinition; - -class EnumNodeDefinitionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage ->values() must be called with at least two distinct values. - */ - public function testNoDistinctValues() - { - $def = new EnumNodeDefinition('foo'); - $def->values(array('foo', 'foo')); - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage You must call ->values() on enum nodes. - */ - public function testNoValuesPassed() - { - $def = new EnumNodeDefinition('foo'); - $def->getNode(); - } - - public function testGetNode() - { - $def = new EnumNodeDefinition('foo'); - $def->values(array('foo', 'bar')); - - $node = $def->getNode(); - $this->assertEquals(array('foo', 'bar'), $node->getValues()); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php deleted file mode 100644 index 147bf13..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php +++ /dev/null @@ -1,215 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\TreeBuilder; - -class ExprBuilderTest extends \PHPUnit_Framework_TestCase -{ - public function testAlwaysExpression() - { - $test = $this->getTestBuilder() - ->always($this->returnClosure('new_value')) - ->end(); - - $this->assertFinalizedValueIs('new_value', $test); - } - - public function testIfTrueExpression() - { - $test = $this->getTestBuilder() - ->ifTrue() - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test, array('key' => true)); - - $test = $this->getTestBuilder() - ->ifTrue(function ($v) { return true; }) - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test); - - $test = $this->getTestBuilder() - ->ifTrue(function ($v) { return false; }) - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('value', $test); - } - - public function testIfStringExpression() - { - $test = $this->getTestBuilder() - ->ifString() - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test); - - $test = $this->getTestBuilder() - ->ifString() - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs(45, $test, array('key' => 45)); - } - - public function testIfNullExpression() - { - $test = $this->getTestBuilder() - ->ifNull() - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test, array('key' => null)); - - $test = $this->getTestBuilder() - ->ifNull() - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('value', $test); - } - - public function testIfArrayExpression() - { - $test = $this->getTestBuilder() - ->ifArray() - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test, array('key' => array())); - - $test = $this->getTestBuilder() - ->ifArray() - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('value', $test); - } - - public function testIfInArrayExpression() - { - $test = $this->getTestBuilder() - ->ifInArray(array('foo', 'bar', 'value')) - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test); - - $test = $this->getTestBuilder() - ->ifInArray(array('foo', 'bar')) - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('value', $test); - } - - public function testIfNotInArrayExpression() - { - $test = $this->getTestBuilder() - ->ifNotInArray(array('foo', 'bar')) - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test); - - $test = $this->getTestBuilder() - ->ifNotInArray(array('foo', 'bar', 'value_from_config')) - ->then($this->returnClosure('new_value')) - ->end(); - $this->assertFinalizedValueIs('new_value', $test); - } - - public function testThenEmptyArrayExpression() - { - $test = $this->getTestBuilder() - ->ifString() - ->thenEmptyArray() - ->end(); - $this->assertFinalizedValueIs(array(), $test); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - */ - public function testThenInvalid() - { - $test = $this->getTestBuilder() - ->ifString() - ->thenInvalid('Invalid value') - ->end(); - $this->finalizeTestBuilder($test); - } - - public function testThenUnsetExpression() - { - $test = $this->getTestBuilder() - ->ifString() - ->thenUnset() - ->end(); - $this->assertEquals(array(), $this->finalizeTestBuilder($test)); - } - - /** - * Create a test treebuilder with a variable node, and init the validation. - * - * @return TreeBuilder - */ - protected function getTestBuilder() - { - $builder = new TreeBuilder(); - - return $builder - ->root('test') - ->children() - ->variableNode('key') - ->validate() - ; - } - - /** - * Close the validation process and finalize with the given config. - * - * @param TreeBuilder $testBuilder The tree builder to finalize - * @param array $config The config you want to use for the finalization, if nothing provided - * a simple array('key'=>'value') will be used - * - * @return array The finalized config values - */ - protected function finalizeTestBuilder($testBuilder, $config = null) - { - return $testBuilder - ->end() - ->end() - ->end() - ->buildTree() - ->finalize(null === $config ? array('key' => 'value') : $config) - ; - } - - /** - * Return a closure that will return the given value. - * - * @param mixed $val The value that the closure must return - * - * @return \Closure - */ - protected function returnClosure($val) - { - return function ($v) use ($val) { - return $val; - }; - } - - /** - * Assert that the given test builder, will return the given value. - * - * @param mixed $value The value to test - * @param TreeBuilder $treeBuilder The tree builder to finalize - * @param mixed $config The config values that new to be finalized - */ - protected function assertFinalizedValueIs($value, $treeBuilder, $config = null) - { - $this->assertEquals(array('key' => $value), $this->finalizeTestBuilder($treeBuilder, $config)); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php deleted file mode 100644 index 22c399c..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder; -use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition; - -class NodeBuilderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \RuntimeException - */ - public function testThrowsAnExceptionWhenTryingToCreateANonRegisteredNodeType() - { - $builder = new BaseNodeBuilder(); - $builder->node('', 'foobar'); - } - - /** - * @expectedException \RuntimeException - */ - public function testThrowsAnExceptionWhenTheNodeClassIsNotFound() - { - $builder = new BaseNodeBuilder(); - $builder - ->setNodeClass('noclasstype', '\\foo\\bar\\noclass') - ->node('', 'noclasstype'); - } - - public function testAddingANewNodeType() - { - $class = __NAMESPACE__.'\\SomeNodeDefinition'; - - $builder = new BaseNodeBuilder(); - $node = $builder - ->setNodeClass('newtype', $class) - ->node('', 'newtype'); - - $this->assertInstanceOf($class, $node); - } - - public function testOverridingAnExistingNodeType() - { - $class = __NAMESPACE__.'\\SomeNodeDefinition'; - - $builder = new BaseNodeBuilder(); - $node = $builder - ->setNodeClass('variable', $class) - ->node('', 'variable'); - - $this->assertInstanceOf($class, $node); - } - - public function testNodeTypesAreNotCaseSensitive() - { - $builder = new BaseNodeBuilder(); - - $node1 = $builder->node('', 'VaRiAbLe'); - $node2 = $builder->node('', 'variable'); - - $this->assertInstanceOf(get_class($node1), $node2); - - $builder->setNodeClass('CuStOm', __NAMESPACE__.'\\SomeNodeDefinition'); - - $node1 = $builder->node('', 'CUSTOM'); - $node2 = $builder->node('', 'custom'); - - $this->assertInstanceOf(get_class($node1), $node2); - } - - public function testNumericNodeCreation() - { - $builder = new BaseNodeBuilder(); - - $node = $builder->integerNode('foo')->min(3)->max(5); - $this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition', $node); - - $node = $builder->floatNode('bar')->min(3.0)->max(5.0); - $this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\FloatNodeDefinition', $node); - } -} - -class SomeNodeDefinition extends BaseVariableNodeDefinition -{ -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php deleted file mode 100644 index cf0813a..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition; -use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition; -use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition; - -class NumericNodeDefinitionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage You cannot define a min(4) as you already have a max(3) - */ - public function testIncoherentMinAssertion() - { - $def = new NumericNodeDefinition('foo'); - $def->max(3)->min(4); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage You cannot define a max(2) as you already have a min(3) - */ - public function testIncoherentMaxAssertion() - { - $node = new NumericNodeDefinition('foo'); - $node->min(3)->max(2); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage The value 4 is too small for path "foo". Should be greater than or equal to 5 - */ - public function testIntegerMinAssertion() - { - $def = new IntegerNodeDefinition('foo'); - $def->min(5)->getNode()->finalize(4); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage The value 4 is too big for path "foo". Should be less than or equal to 3 - */ - public function testIntegerMaxAssertion() - { - $def = new IntegerNodeDefinition('foo'); - $def->max(3)->getNode()->finalize(4); - } - - public function testIntegerValidMinMaxAssertion() - { - $def = new IntegerNodeDefinition('foo'); - $node = $def->min(3)->max(7)->getNode(); - $this->assertEquals(4, $node->finalize(4)); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage The value 400 is too small for path "foo". Should be greater than or equal to 500 - */ - public function testFloatMinAssertion() - { - $def = new FloatNodeDefinition('foo'); - $def->min(5E2)->getNode()->finalize(4e2); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage The value 4.3 is too big for path "foo". Should be less than or equal to 0.3 - */ - public function testFloatMaxAssertion() - { - $def = new FloatNodeDefinition('foo'); - $def->max(0.3)->getNode()->finalize(4.3); - } - - public function testFloatValidMinMaxAssertion() - { - $def = new FloatNodeDefinition('foo'); - $node = $def->min(3.0)->max(7e2)->getNode(); - $this->assertEquals(4.5, $node->finalize(4.5)); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php deleted file mode 100644 index 00e27c6..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder as CustomNodeBuilder; -use Symfony\Component\Config\Definition\Builder\TreeBuilder; - -require __DIR__.'/../../Fixtures/Builder/NodeBuilder.php'; -require __DIR__.'/../../Fixtures/Builder/BarNodeDefinition.php'; -require __DIR__.'/../../Fixtures/Builder/VariableNodeDefinition.php'; - -class TreeBuilderTest extends \PHPUnit_Framework_TestCase -{ - public function testUsingACustomNodeBuilder() - { - $builder = new TreeBuilder(); - $root = $builder->root('custom', 'array', new CustomNodeBuilder()); - - $nodeBuilder = $root->children(); - - $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder); - - $nodeBuilder = $nodeBuilder->arrayNode('deeper')->children(); - - $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder); - } - - public function testOverrideABuiltInNodeType() - { - $builder = new TreeBuilder(); - $root = $builder->root('override', 'array', new CustomNodeBuilder()); - - $definition = $root->children()->variableNode('variable'); - - $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition', $definition); - } - - public function testAddANodeType() - { - $builder = new TreeBuilder(); - $root = $builder->root('override', 'array', new CustomNodeBuilder()); - - $definition = $root->children()->barNode('variable'); - - $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\BarNodeDefinition', $definition); - } - - public function testCreateABuiltInNodeTypeWithACustomNodeBuilder() - { - $builder = new TreeBuilder(); - $root = $builder->root('builtin', 'array', new CustomNodeBuilder()); - - $definition = $root->children()->booleanNode('boolean'); - - $this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition', $definition); - } - - public function testPrototypedArrayNodeUseTheCustomNodeBuilder() - { - $builder = new TreeBuilder(); - $root = $builder->root('override', 'array', new CustomNodeBuilder()); - - $root->prototype('bar')->end(); - } - - public function testAnExtendedNodeBuilderGetsPropagatedToTheChildren() - { - $builder = new TreeBuilder(); - - $builder->root('propagation') - ->children() - ->setNodeClass('extended', 'Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition') - ->node('foo', 'extended')->end() - ->arrayNode('child') - ->children() - ->node('foo', 'extended') - ->end() - ->end() - ->end() - ->end(); - } - - public function testDefinitionInfoGetsTransferredToNode() - { - $builder = new TreeBuilder(); - - $builder->root('test')->info('root info') - ->children() - ->node('child', 'variable')->info('child info')->defaultValue('default') - ->end() - ->end(); - - $tree = $builder->buildTree(); - $children = $tree->getChildren(); - - $this->assertEquals('root info', $tree->getInfo()); - $this->assertEquals('child info', $children['child']->getInfo()); - } - - public function testDefinitionExampleGetsTransferredToNode() - { - $builder = new TreeBuilder(); - - $builder->root('test') - ->example(array('key' => 'value')) - ->children() - ->node('child', 'variable')->info('child info')->defaultValue('default')->example('example') - ->end() - ->end(); - - $tree = $builder->buildTree(); - $children = $tree->getChildren(); - - $this->assertTrue(is_array($tree->getExample())); - $this->assertEquals('example', $children['child']->getExample()); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php deleted file mode 100644 index ab6bdaa..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Dumper; - -use Symfony\Component\Config\Definition\Dumper\XmlReferenceDumper; -use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration; - -class XmlReferenceDumperTest extends \PHPUnit_Framework_TestCase -{ - public function testDumper() - { - $configuration = new ExampleConfiguration(); - - $dumper = new XmlReferenceDumper(); - $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration)); - } - - public function testNamespaceDumper() - { - $configuration = new ExampleConfiguration(); - - $dumper = new XmlReferenceDumper(); - $this->assertEquals(str_replace('http://example.org/schema/dic/acme_root', 'http://symfony.com/schema/dic/symfony', $this->getConfigurationAsString()), $dumper->dump($configuration, 'http://symfony.com/schema/dic/symfony')); - } - - private function getConfigurationAsString() - { - return <<<EOL -<!-- Namespace: http://example.org/schema/dic/acme_root --> -<!-- scalar-required: Required --> -<!-- enum: One of "this"; "that" --> -<config - boolean="true" - scalar-empty="" - scalar-null="null" - scalar-true="true" - scalar-false="false" - scalar-default="default" - scalar-array-empty="" - scalar-array-defaults="elem1,elem2" - scalar-required="" - enum="" -> - - <!-- some info --> - <!-- - child3: this is a long - multi-line info text - which should be indented; - Example: example setting - --> - <array - child1="" - child2="" - child3="" - /> - - <!-- prototype --> - <parameter name="parameter name">scalar value</parameter> - - <!-- prototype --> - <connection - user="" - pass="" - /> - -</config> - -EOL; - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php deleted file mode 100644 index 4775235..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Dumper; - -use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper; -use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration; - -class YamlReferenceDumperTest extends \PHPUnit_Framework_TestCase -{ - public function testDumper() - { - $configuration = new ExampleConfiguration(); - - $dumper = new YamlReferenceDumper(); - - $this->markTestIncomplete('The Yaml Dumper currently does not support prototyped arrays'); - $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration)); - } - - private function getConfigurationAsString() - { - return <<<EOL -acme_root: - boolean: true - scalar_empty: ~ - scalar_null: ~ - scalar_true: true - scalar_false: false - scalar_default: default - scalar_array_empty: [] - scalar_array_defaults: - - # Defaults: - - elem1 - - elem2 - scalar_required: ~ # Required - enum: ~ # One of "this"; "that" - - # some info - array: - child1: ~ - child2: ~ - - # this is a long - # multi-line info text - # which should be indented - child3: ~ # Example: example setting - parameters: - - # Prototype - name: ~ - connections: - # Prototype - - { user: ~, pass: ~ } - -EOL; - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php deleted file mode 100644 index 2b84de6..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\EnumNode; - -class EnumNodeTest extends \PHPUnit_Framework_TestCase -{ - public function testFinalizeValue() - { - $node = new EnumNode('foo', null, array('foo', 'bar')); - $this->assertSame('foo', $node->finalize('foo')); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testConstructionWithOneValue() - { - new EnumNode('foo', null, array('foo', 'foo')); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage The value "foobar" is not allowed for path "foo". Permissible values: "foo", "bar" - */ - public function testFinalizeWithInvalidValue() - { - $node = new EnumNode('foo', null, array('foo', 'bar')); - $node->finalize('foobar'); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FinalizationTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FinalizationTest.php deleted file mode 100644 index 19fc347..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FinalizationTest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\Builder\TreeBuilder; -use Symfony\Component\Config\Definition\Processor; -use Symfony\Component\Config\Definition\NodeInterface; - -class FinalizationTest extends \PHPUnit_Framework_TestCase -{ - public function testUnsetKeyWithDeepHierarchy() - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('config', 'array') - ->children() - ->node('level1', 'array') - ->canBeUnset() - ->children() - ->node('level2', 'array') - ->canBeUnset() - ->children() - ->node('somevalue', 'scalar')->end() - ->node('anothervalue', 'scalar')->end() - ->end() - ->end() - ->node('level1_scalar', 'scalar')->end() - ->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $a = array( - 'level1' => array( - 'level2' => array( - 'somevalue' => 'foo', - 'anothervalue' => 'bar', - ), - 'level1_scalar' => 'foo', - ), - ); - - $b = array( - 'level1' => array( - 'level2' => false, - ), - ); - - $this->assertEquals(array( - 'level1' => array( - 'level1_scalar' => 'foo', - ), - ), $this->process($tree, array($a, $b))); - } - - protected function process(NodeInterface $tree, array $configs) - { - $processor = new Processor(); - - return $processor->process($tree, $configs); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php deleted file mode 100644 index 4f308ca..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\FloatNode; - -class FloatNodeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getValidValues - */ - public function testNormalize($value) - { - $node = new FloatNode('test'); - $this->assertSame($value, $node->normalize($value)); - } - - public function getValidValues() - { - return array( - array(1798.0), - array(-678.987), - array(12.56E45), - array(0.0), - // Integer are accepted too, they will be cast - array(17), - array(-10), - array(0), - ); - } - - /** - * @dataProvider getInvalidValues - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException - */ - public function testNormalizeThrowsExceptionOnInvalidValues($value) - { - $node = new FloatNode('test'); - $node->normalize($value); - } - - public function getInvalidValues() - { - return array( - array(null), - array(''), - array('foo'), - array(true), - array(false), - array(array()), - array(array('foo' => 'bar')), - array(new \stdClass()), - ); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php deleted file mode 100644 index 1527db7..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\IntegerNode; - -class IntegerNodeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getValidValues - */ - public function testNormalize($value) - { - $node = new IntegerNode('test'); - $this->assertSame($value, $node->normalize($value)); - } - - public function getValidValues() - { - return array( - array(1798), - array(-678), - array(0), - ); - } - - /** - * @dataProvider getInvalidValues - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException - */ - public function testNormalizeThrowsExceptionOnInvalidValues($value) - { - $node = new IntegerNode('test'); - $node->normalize($value); - } - - public function getInvalidValues() - { - return array( - array(null), - array(''), - array('foo'), - array(true), - array(false), - array(0.0), - array(0.1), - array(array()), - array(array('foo' => 'bar')), - array(new \stdClass()), - ); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/MergeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/MergeTest.php deleted file mode 100644 index 08ddc32..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/MergeTest.php +++ /dev/null @@ -1,195 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\Builder\TreeBuilder; - -class MergeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException - */ - public function testForbiddenOverwrite() - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('root', 'array') - ->children() - ->node('foo', 'scalar') - ->cannotBeOverwritten() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $a = array( - 'foo' => 'bar', - ); - - $b = array( - 'foo' => 'moo', - ); - - $tree->merge($a, $b); - } - - public function testUnsetKey() - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('root', 'array') - ->children() - ->node('foo', 'scalar')->end() - ->node('bar', 'scalar')->end() - ->node('unsettable', 'array') - ->canBeUnset() - ->children() - ->node('foo', 'scalar')->end() - ->node('bar', 'scalar')->end() - ->end() - ->end() - ->node('unsetted', 'array') - ->canBeUnset() - ->prototype('scalar')->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $a = array( - 'foo' => 'bar', - 'unsettable' => array( - 'foo' => 'a', - 'bar' => 'b', - ), - 'unsetted' => false, - ); - - $b = array( - 'foo' => 'moo', - 'bar' => 'b', - 'unsettable' => false, - 'unsetted' => array('a', 'b'), - ); - - $this->assertEquals(array( - 'foo' => 'moo', - 'bar' => 'b', - 'unsettable' => false, - 'unsetted' => array('a', 'b'), - ), $tree->merge($a, $b)); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - */ - public function testDoesNotAllowNewKeysInSubsequentConfigs() - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('config', 'array') - ->children() - ->node('test', 'array') - ->disallowNewKeysInSubsequentConfigs() - ->useAttributeAsKey('key') - ->prototype('array') - ->children() - ->node('value', 'scalar')->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->buildTree(); - - $a = array( - 'test' => array( - 'a' => array('value' => 'foo'), - ), - ); - - $b = array( - 'test' => array( - 'b' => array('value' => 'foo'), - ), - ); - - $tree->merge($a, $b); - } - - public function testPerformsNoDeepMerging() - { - $tb = new TreeBuilder(); - - $tree = $tb - ->root('config', 'array') - ->children() - ->node('no_deep_merging', 'array') - ->performNoDeepMerging() - ->children() - ->node('foo', 'scalar')->end() - ->node('bar', 'scalar')->end() - ->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $a = array( - 'no_deep_merging' => array( - 'foo' => 'a', - 'bar' => 'b', - ), - ); - - $b = array( - 'no_deep_merging' => array( - 'c' => 'd', - ), - ); - - $this->assertEquals(array( - 'no_deep_merging' => array( - 'c' => 'd', - ), - ), $tree->merge($a, $b)); - } - - public function testPrototypeWithoutAKeyAttribute() - { - $tb = new TreeBuilder(); - - $tree = $tb - ->root('config', 'array') - ->children() - ->arrayNode('append_elements') - ->prototype('scalar')->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $a = array( - 'append_elements' => array('a', 'b'), - ); - - $b = array( - 'append_elements' => array('c', 'd'), - ); - - $this->assertEquals(array('append_elements' => array('a', 'b', 'c', 'd')), $tree->merge($a, $b)); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/NormalizationTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/NormalizationTest.php deleted file mode 100644 index a896f96..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/NormalizationTest.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\Builder\TreeBuilder; - -class NormalizationTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getEncoderTests - */ - public function testNormalizeEncoders($denormalized) - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('root_name', 'array') - ->fixXmlConfig('encoder') - ->children() - ->node('encoders', 'array') - ->useAttributeAsKey('class') - ->prototype('array') - ->beforeNormalization()->ifString()->then(function ($v) { return array('algorithm' => $v); })->end() - ->children() - ->node('algorithm', 'scalar')->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $normalized = array( - 'encoders' => array( - 'foo' => array('algorithm' => 'plaintext'), - ), - ); - - $this->assertNormalized($tree, $denormalized, $normalized); - } - - public function getEncoderTests() - { - $configs = array(); - - // XML - $configs[] = array( - 'encoder' => array( - array('class' => 'foo', 'algorithm' => 'plaintext'), - ), - ); - - // XML when only one element of this type - $configs[] = array( - 'encoder' => array('class' => 'foo', 'algorithm' => 'plaintext'), - ); - - // YAML/PHP - $configs[] = array( - 'encoders' => array( - array('class' => 'foo', 'algorithm' => 'plaintext'), - ), - ); - - // YAML/PHP - $configs[] = array( - 'encoders' => array( - 'foo' => 'plaintext', - ), - ); - - // YAML/PHP - $configs[] = array( - 'encoders' => array( - 'foo' => array('algorithm' => 'plaintext'), - ), - ); - - return array_map(function ($v) { - return array($v); - }, $configs); - } - - /** - * @dataProvider getAnonymousKeysTests - */ - public function testAnonymousKeysArray($denormalized) - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('root', 'array') - ->children() - ->node('logout', 'array') - ->fixXmlConfig('handler') - ->children() - ->node('handlers', 'array') - ->prototype('scalar')->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $normalized = array('logout' => array('handlers' => array('a', 'b', 'c'))); - - $this->assertNormalized($tree, $denormalized, $normalized); - } - - public function getAnonymousKeysTests() - { - $configs = array(); - - $configs[] = array( - 'logout' => array( - 'handlers' => array('a', 'b', 'c'), - ), - ); - - $configs[] = array( - 'logout' => array( - 'handler' => array('a', 'b', 'c'), - ), - ); - - return array_map(function ($v) { return array($v); }, $configs); - } - - /** - * @dataProvider getNumericKeysTests - */ - public function testNumericKeysAsAttributes($denormalized) - { - $normalized = array( - 'thing' => array(42 => array('foo', 'bar'), 1337 => array('baz', 'qux')), - ); - - $this->assertNormalized($this->getNumericKeysTestTree(), $denormalized, $normalized); - } - - public function getNumericKeysTests() - { - $configs = array(); - - $configs[] = array( - 'thing' => array( - 42 => array('foo', 'bar'), 1337 => array('baz', 'qux'), - ), - ); - - $configs[] = array( - 'thing' => array( - array('foo', 'bar', 'id' => 42), array('baz', 'qux', 'id' => 1337), - ), - ); - - return array_map(function ($v) { return array($v); }, $configs); - } - - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - * @expectedExceptionMessage The attribute "id" must be set for path "root.thing". - */ - public function testNonAssociativeArrayThrowsExceptionIfAttributeNotSet() - { - $denormalized = array( - 'thing' => array( - array('foo', 'bar'), array('baz', 'qux'), - ), - ); - - $this->assertNormalized($this->getNumericKeysTestTree(), $denormalized, array()); - } - - public function testAssociativeArrayPreserveKeys() - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('root', 'array') - ->prototype('array') - ->children() - ->node('foo', 'scalar')->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - $data = array('first' => array('foo' => 'bar')); - - $this->assertNormalized($tree, $data, $data); - } - - public static function assertNormalized(NodeInterface $tree, $denormalized, $normalized) - { - self::assertSame($normalized, $tree->normalize($denormalized)); - } - - private function getNumericKeysTestTree() - { - $tb = new TreeBuilder(); - $tree = $tb - ->root('root', 'array') - ->children() - ->node('thing', 'array') - ->useAttributeAsKey('id') - ->prototype('array') - ->prototype('scalar')->end() - ->end() - ->end() - ->end() - ->end() - ->buildTree() - ; - - return $tree; - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php deleted file mode 100644 index c343fcf..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\PrototypedArrayNode; -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\ScalarNode; - -class PrototypedArrayNodeTest extends \PHPUnit_Framework_TestCase -{ - public function testGetDefaultValueReturnsAnEmptyArrayForPrototypes() - { - $node = new PrototypedArrayNode('root'); - $prototype = new ArrayNode(null, $node); - $node->setPrototype($prototype); - $this->assertEmpty($node->getDefaultValue()); - } - - public function testGetDefaultValueReturnsDefaultValueForPrototypes() - { - $node = new PrototypedArrayNode('root'); - $prototype = new ArrayNode(null, $node); - $node->setPrototype($prototype); - $node->setDefaultValue(array('test')); - $this->assertEquals(array('test'), $node->getDefaultValue()); - } - - // a remapped key (e.g. "mapping" -> "mappings") should be unset after being used - public function testRemappedKeysAreUnset() - { - $node = new ArrayNode('root'); - $mappingsNode = new PrototypedArrayNode('mappings'); - $node->addChild($mappingsNode); - - // each item under mappings is just a scalar - $prototype = new ScalarNode(null, $mappingsNode); - $mappingsNode->setPrototype($prototype); - - $remappings = array(); - $remappings[] = array('mapping', 'mappings'); - $node->setXmlRemappings($remappings); - - $normalized = $node->normalize(array('mapping' => array('foo', 'bar'))); - $this->assertEquals(array('mappings' => array('foo', 'bar')), $normalized); - } - - /** - * Tests that when a key attribute is mapped, that key is removed from the array. - * - * <things> - * <option id="option1" value="foo"> - * <option id="option2" value="bar"> - * </things> - * - * The above should finally be mapped to an array that looks like this - * (because "id" is the key attribute). - * - * array( - * 'things' => array( - * 'option1' => 'foo', - * 'option2' => 'bar', - * ) - * ) - */ - public function testMappedAttributeKeyIsRemoved() - { - $node = new PrototypedArrayNode('root'); - $node->setKeyAttribute('id', true); - - // each item under the root is an array, with one scalar item - $prototype = new ArrayNode(null, $node); - $prototype->addChild(new ScalarNode('foo')); - $node->setPrototype($prototype); - - $children = array(); - $children[] = array('id' => 'item_name', 'foo' => 'bar'); - $normalized = $node->normalize($children); - - $expected = array(); - $expected['item_name'] = array('foo' => 'bar'); - $this->assertEquals($expected, $normalized); - } - - /** - * Tests the opposite of the testMappedAttributeKeyIsRemoved because - * the removal can be toggled with an option. - */ - public function testMappedAttributeKeyNotRemoved() - { - $node = new PrototypedArrayNode('root'); - $node->setKeyAttribute('id', false); - - // each item under the root is an array, with two scalar items - $prototype = new ArrayNode(null, $node); - $prototype->addChild(new ScalarNode('foo')); - $prototype->addChild(new ScalarNode('id')); // the key attribute will remain - $node->setPrototype($prototype); - - $children = array(); - $children[] = array('id' => 'item_name', 'foo' => 'bar'); - $normalized = $node->normalize($children); - - $expected = array(); - $expected['item_name'] = array('id' => 'item_name', 'foo' => 'bar'); - $this->assertEquals($expected, $normalized); - } - - public function testAddDefaultChildren() - { - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setAddChildrenIfNoneSet(); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array(array('foo' => 'bar')), $node->getDefaultValue()); - - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setKeyAttribute('foobar'); - $node->setAddChildrenIfNoneSet(); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array('defaults' => array('foo' => 'bar')), $node->getDefaultValue()); - - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setKeyAttribute('foobar'); - $node->setAddChildrenIfNoneSet('defaultkey'); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array('defaultkey' => array('foo' => 'bar')), $node->getDefaultValue()); - - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setKeyAttribute('foobar'); - $node->setAddChildrenIfNoneSet(array('defaultkey')); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array('defaultkey' => array('foo' => 'bar')), $node->getDefaultValue()); - - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setKeyAttribute('foobar'); - $node->setAddChildrenIfNoneSet(array('dk1', 'dk2')); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array('dk1' => array('foo' => 'bar'), 'dk2' => array('foo' => 'bar')), $node->getDefaultValue()); - - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setAddChildrenIfNoneSet(array(5, 6)); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array(0 => array('foo' => 'bar'), 1 => array('foo' => 'bar')), $node->getDefaultValue()); - - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setAddChildrenIfNoneSet(2); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array(array('foo' => 'bar'), array('foo' => 'bar')), $node->getDefaultValue()); - } - - public function testDefaultChildrenWinsOverDefaultValue() - { - $node = $this->getPrototypeNodeWithDefaultChildren(); - $node->setAddChildrenIfNoneSet(); - $node->setDefaultValue(array('bar' => 'foo')); - $this->assertTrue($node->hasDefaultValue()); - $this->assertEquals(array(array('foo' => 'bar')), $node->getDefaultValue()); - } - - protected function getPrototypeNodeWithDefaultChildren() - { - $node = new PrototypedArrayNode('root'); - $prototype = new ArrayNode(null, $node); - $child = new ScalarNode('foo'); - $child->setDefaultValue('bar'); - $prototype->addChild($child); - $prototype->setAddIfNotSet(true); - $node->setPrototype($prototype); - - return $node; - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php deleted file mode 100644 index a798410..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition; - -use Symfony\Component\Config\Definition\ScalarNode; - -class ScalarNodeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getValidValues - */ - public function testNormalize($value) - { - $node = new ScalarNode('test'); - $this->assertSame($value, $node->normalize($value)); - } - - public function getValidValues() - { - return array( - array(false), - array(true), - array(null), - array(''), - array('foo'), - array(0), - array(1), - array(0.0), - array(0.1), - ); - } - - /** - * @dataProvider getInvalidValues - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException - */ - public function testNormalizeThrowsExceptionOnInvalidValues($value) - { - $node = new ScalarNode('test'); - $node->normalize($value); - } - - public function getInvalidValues() - { - return array( - array(array()), - array(array('foo' => 'bar')), - array(new \stdClass()), - ); - } - - public function testNormalizeThrowsExceptionWithoutHint() - { - $node = new ScalarNode('test'); - - $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.'); - - $node->normalize(array()); - } - - public function testNormalizeThrowsExceptionWithErrorMessage() - { - $node = new ScalarNode('test'); - $node->setInfo('"the test value"'); - - $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\""); - - $node->normalize(array()); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php deleted file mode 100644 index 4d91535..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Exception; - -use Symfony\Component\Config\Exception\FileLoaderLoadException; - -class FileLoaderLoadExceptionTest extends \PHPUnit_Framework_TestCase -{ - public function testMessageCannotLoadResource() - { - $exception = new FileLoaderLoadException('resource', null); - $this->assertEquals('Cannot load resource "resource".', $exception->getMessage()); - } - - public function testMessageCannotImportResourceFromSource() - { - $exception = new FileLoaderLoadException('resource', 'sourceResource'); - $this->assertEquals('Cannot import resource "resource" from "sourceResource".', $exception->getMessage()); - } - - public function testMessageCannotImportBundleResource() - { - $exception = new FileLoaderLoadException('@resource', 'sourceResource'); - $this->assertEquals( - 'Cannot import resource "@resource" from "sourceResource". '. - 'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class.', - $exception->getMessage() - ); - } - - public function testMessageHasPreviousErrorWithDotAndUnableToLoad() - { - $exception = new FileLoaderLoadException( - 'resource', - null, - null, - new \Exception('There was a previous error with an ending dot.') - ); - $this->assertEquals( - 'There was a previous error with an ending dot in resource (which is loaded in resource "resource").', - $exception->getMessage() - ); - } - - public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad() - { - $exception = new FileLoaderLoadException( - 'resource', - null, - null, - new \Exception('There was a previous error with no ending dot') - ); - $this->assertEquals( - 'There was a previous error with no ending dot in resource (which is loaded in resource "resource").', - $exception->getMessage() - ); - } - - public function testMessageHasPreviousErrorAndUnableToLoadBundle() - { - $exception = new FileLoaderLoadException( - '@resource', - null, - null, - new \Exception('There was a previous error with an ending dot.') - ); - $this->assertEquals( - 'There was a previous error with an ending dot in @resource '. - '(which is loaded in resource "@resource"). '. - 'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class.', - $exception->getMessage() - ); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/FileLocatorTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/FileLocatorTest.php deleted file mode 100644 index d479f25..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/FileLocatorTest.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests; - -use Symfony\Component\Config\FileLocator; - -class FileLocatorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getIsAbsolutePathTests - */ - public function testIsAbsolutePath($path) - { - $loader = new FileLocator(array()); - $r = new \ReflectionObject($loader); - $m = $r->getMethod('isAbsolutePath'); - $m->setAccessible(true); - - $this->assertTrue($m->invoke($loader, $path), '->isAbsolutePath() returns true for an absolute path'); - } - - public function getIsAbsolutePathTests() - { - return array( - array('/foo.xml'), - array('c:\\\\foo.xml'), - array('c:/foo.xml'), - array('\\server\\foo.xml'), - array('https://server/foo.xml'), - array('phar://server/foo.xml'), - ); - } - - public function testLocate() - { - $loader = new FileLocator(__DIR__.'/Fixtures'); - - $this->assertEquals( - __DIR__.DIRECTORY_SEPARATOR.'FileLocatorTest.php', - $loader->locate('FileLocatorTest.php', __DIR__), - '->locate() returns the absolute filename if the file exists in the given path' - ); - - $this->assertEquals( - __DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', - $loader->locate('foo.xml', __DIR__), - '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor' - ); - - $this->assertEquals( - __DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', - $loader->locate(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__), - '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor' - ); - - $loader = new FileLocator(array(__DIR__.'/Fixtures', __DIR__.'/Fixtures/Again')); - - $this->assertEquals( - array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), - $loader->locate('foo.xml', __DIR__, false), - '->locate() returns an array of absolute filenames' - ); - - $this->assertEquals( - array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), - $loader->locate('foo.xml', __DIR__.'/Fixtures', false), - '->locate() returns an array of absolute filenames' - ); - - $loader = new FileLocator(__DIR__.'/Fixtures/Again'); - - $this->assertEquals( - array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), - $loader->locate('foo.xml', __DIR__.'/Fixtures', false), - '->locate() returns an array of absolute filenames' - ); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The file "foobar.xml" does not exist - */ - public function testLocateThrowsAnExceptionIfTheFileDoesNotExists() - { - $loader = new FileLocator(array(__DIR__.'/Fixtures')); - - $loader->locate('foobar.xml', __DIR__); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testLocateThrowsAnExceptionIfTheFileDoesNotExistsInAbsolutePath() - { - $loader = new FileLocator(array(__DIR__.'/Fixtures')); - - $loader->locate(__DIR__.'/Fixtures/foobar.xml', __DIR__); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage An empty file name is not valid to be located. - */ - public function testLocateEmpty() - { - $loader = new FileLocator(array(__DIR__.'/Fixtures')); - - $loader->locate(null, __DIR__); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Again/foo.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Again/foo.xml deleted file mode 100644 index e69de29..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Again/foo.xml +++ /dev/null diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php deleted file mode 100644 index 47701c1..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\NodeDefinition; - -class BarNodeDefinition extends NodeDefinition -{ - protected function createNode() - { - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php deleted file mode 100644 index aa59863..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder; - -class NodeBuilder extends BaseNodeBuilder -{ - public function barNode($name) - { - return $this->node($name, 'bar'); - } - - protected function getNodeClass($type) - { - switch ($type) { - case 'variable': - return __NAMESPACE__.'\\'.ucfirst($type).'NodeDefinition'; - case 'bar': - return __NAMESPACE__.'\\'.ucfirst($type).'NodeDefinition'; - default: - return parent::getNodeClass($type); - } - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php deleted file mode 100644 index 1017880..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Definition\Builder; - -use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition; - -class VariableNodeDefinition extends BaseVariableNodeDefinition -{ -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php deleted file mode 100644 index df43e8b..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Fixtures\Configuration; - -use Symfony\Component\Config\Definition\Builder\TreeBuilder; -use Symfony\Component\Config\Definition\ConfigurationInterface; - -class ExampleConfiguration implements ConfigurationInterface -{ - public function getConfigTreeBuilder() - { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('acme_root'); - - $rootNode - ->fixXmlConfig('parameter') - ->fixXmlConfig('connection') - ->children() - ->booleanNode('boolean')->defaultTrue()->end() - ->scalarNode('scalar_empty')->end() - ->scalarNode('scalar_null')->defaultNull()->end() - ->scalarNode('scalar_true')->defaultTrue()->end() - ->scalarNode('scalar_false')->defaultFalse()->end() - ->scalarNode('scalar_default')->defaultValue('default')->end() - ->scalarNode('scalar_array_empty')->defaultValue(array())->end() - ->scalarNode('scalar_array_defaults')->defaultValue(array('elem1', 'elem2'))->end() - ->scalarNode('scalar_required')->isRequired()->end() - ->enumNode('enum')->values(array('this', 'that'))->end() - ->arrayNode('array') - ->info('some info') - ->canBeUnset() - ->children() - ->scalarNode('child1')->end() - ->scalarNode('child2')->end() - ->scalarNode('child3') - ->info( - "this is a long\n". - "multi-line info text\n". - 'which should be indented' - ) - ->example('example setting') - ->end() - ->end() - ->end() - ->arrayNode('parameters') - ->useAttributeAsKey('name') - ->prototype('scalar')->end() - ->end() - ->arrayNode('connections') - ->prototype('array') - ->children() - ->scalarNode('user')->end() - ->scalarNode('pass')->end() - ->end() - ->end() - ->end() - ->end() - ; - - return $treeBuilder; - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/document_type.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/document_type.xml deleted file mode 100644 index 4c25228..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/document_type.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE scan [<!ENTITY test SYSTEM "php://filter/read=convert.base64-encode/resource={{ resource }}">]> -<scan></scan> diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid.xml deleted file mode 100644 index a07af9f..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<root> diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid_schema.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid_schema.xml deleted file mode 100644 index e2725a2..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid_schema.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<root2 xmlns="http://example.com/schema" /> diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/schema.xsd b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/schema.xsd deleted file mode 100644 index e56820f..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/schema.xsd +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<xsd:schema xmlns="http://example.com/schema" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://example.com/schema" - elementFormDefault="qualified"> - - <xsd:element name="root" /> -</xsd:schema> diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/valid.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/valid.xml deleted file mode 100644 index a96bb38..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/valid.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<root xmlns="http://example.com/schema"> -</root> diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/foo.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/foo.xml deleted file mode 100644 index e69de29..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/foo.xml +++ /dev/null diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php deleted file mode 100644 index 7641e24..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Loader; - -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\Loader\DelegatingLoader; - -class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::__construct - */ - public function testConstructor() - { - $loader = new DelegatingLoader($resolver = new LoaderResolver()); - $this->assertTrue(true, '__construct() takes a loader resolver as its first argument'); - } - - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::getResolver - * @covers Symfony\Component\Config\Loader\DelegatingLoader::setResolver - */ - public function testGetSetResolver() - { - $resolver = new LoaderResolver(); - $loader = new DelegatingLoader($resolver); - $this->assertSame($resolver, $loader->getResolver(), '->getResolver() gets the resolver loader'); - $loader->setResolver($resolver = new LoaderResolver()); - $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader'); - } - - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::supports - */ - public function testSupports() - { - $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $loader1->expects($this->once())->method('supports')->will($this->returnValue(true)); - $loader = new DelegatingLoader(new LoaderResolver(array($loader1))); - $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); - - $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $loader1->expects($this->once())->method('supports')->will($this->returnValue(false)); - $loader = new DelegatingLoader(new LoaderResolver(array($loader1))); - $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); - } - - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::load - */ - public function testLoad() - { - $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $loader->expects($this->once())->method('supports')->will($this->returnValue(true)); - $loader->expects($this->once())->method('load'); - $resolver = new LoaderResolver(array($loader)); - $loader = new DelegatingLoader($resolver); - - $loader->load('foo'); - } - - /** - * @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException - */ - public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded() - { - $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $loader->expects($this->once())->method('supports')->will($this->returnValue(false)); - $resolver = new LoaderResolver(array($loader)); - $loader = new DelegatingLoader($resolver); - - $loader->load('foo'); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php deleted file mode 100644 index 1442e94..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Loader; - -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\Loader\LoaderResolver; - -class FileLoaderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Symfony\Component\Config\Loader\FileLoader - */ - public function testImportWithFileLocatorDelegation() - { - $locatorMock = $this->getMock('Symfony\Component\Config\FileLocatorInterface'); - - $locatorMockForAdditionalLoader = $this->getMock('Symfony\Component\Config\FileLocatorInterface'); - $locatorMockForAdditionalLoader->expects($this->any())->method('locate')->will($this->onConsecutiveCalls( - array('path/to/file1'), // Default - array('path/to/file1', 'path/to/file2'), // First is imported - array('path/to/file1', 'path/to/file2'), // Second is imported - array('path/to/file1'), // Exception - array('path/to/file1', 'path/to/file2') // Exception - )); - - $fileLoader = new TestFileLoader($locatorMock); - $fileLoader->setSupports(false); - $fileLoader->setCurrentDir('.'); - - $additionalLoader = new TestFileLoader($locatorMockForAdditionalLoader); - $additionalLoader->setCurrentDir('.'); - - $fileLoader->setResolver($loaderResolver = new LoaderResolver(array($fileLoader, $additionalLoader))); - - // Default case - $this->assertSame('path/to/file1', $fileLoader->import('my_resource')); - - // Check first file is imported if not already loading - $this->assertSame('path/to/file1', $fileLoader->import('my_resource')); - - // Check second file is imported if first is already loading - $fileLoader->addLoading('path/to/file1'); - $this->assertSame('path/to/file2', $fileLoader->import('my_resource')); - - // Check exception throws if first (and only available) file is already loading - try { - $fileLoader->import('my_resource'); - $this->fail('->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); - } catch (\Exception $e) { - $this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException', $e, '->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); - } - - // Check exception throws if all files are already loading - try { - $fileLoader->addLoading('path/to/file2'); - $fileLoader->import('my_resource'); - $this->fail('->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); - } catch (\Exception $e) { - $this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException', $e, '->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); - } - } -} - -class TestFileLoader extends FileLoader -{ - private $supports = true; - - public function load($resource, $type = null) - { - return $resource; - } - - public function supports($resource, $type = null) - { - return $this->supports; - } - - public function addLoading($resource) - { - self::$loading[$resource] = true; - } - - public function removeLoading($resource) - { - unset(self::$loading[$resource]); - } - - public function clearLoading() - { - self::$loading = array(); - } - - public function setSupports($supports) - { - $this->supports = $supports; - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php deleted file mode 100644 index 8ee276b..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Loader; - -use Symfony\Component\Config\Loader\LoaderResolver; - -class LoaderResolverTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Symfony\Component\Config\Loader\LoaderResolver::__construct - */ - public function testConstructor() - { - $resolver = new LoaderResolver(array( - $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'), - )); - - $this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument'); - } - - /** - * @covers Symfony\Component\Config\Loader\LoaderResolver::resolve - */ - public function testResolve() - { - $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $resolver = new LoaderResolver(array($loader)); - $this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource'); - - $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $loader->expects($this->once())->method('supports')->will($this->returnValue(true)); - $resolver = new LoaderResolver(array($loader)); - $this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource'); - } - - /** - * @covers Symfony\Component\Config\Loader\LoaderResolver::getLoaders - * @covers Symfony\Component\Config\Loader\LoaderResolver::addLoader - */ - public function testLoaders() - { - $resolver = new LoaderResolver(); - $resolver->addLoader($loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface')); - - $this->assertEquals(array($loader), $resolver->getLoaders(), 'addLoader() adds a loader'); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderTest.php deleted file mode 100644 index e938a4b..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderTest.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Loader; - -use Symfony\Component\Config\Loader\Loader; - -class LoaderTest extends \PHPUnit_Framework_TestCase -{ - public function testGetSetResolver() - { - $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); - - $loader = new ProjectLoader1(); - $loader->setResolver($resolver); - - $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader'); - } - - public function testResolve() - { - $resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - - $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); - $resolver->expects($this->once()) - ->method('resolve') - ->with('foo.xml') - ->will($this->returnValue($resolvedLoader)); - - $loader = new ProjectLoader1(); - $loader->setResolver($resolver); - - $this->assertSame($loader, $loader->resolve('foo.foo'), '->resolve() finds a loader'); - $this->assertSame($resolvedLoader, $loader->resolve('foo.xml'), '->resolve() finds a loader'); - } - - /** - * @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException - */ - public function testResolveWhenResolverCannotFindLoader() - { - $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); - $resolver->expects($this->once()) - ->method('resolve') - ->with('FOOBAR') - ->will($this->returnValue(false)); - - $loader = new ProjectLoader1(); - $loader->setResolver($resolver); - - $loader->resolve('FOOBAR'); - } - - public function testImport() - { - $resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $resolvedLoader->expects($this->once()) - ->method('load') - ->with('foo') - ->will($this->returnValue('yes')); - - $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); - $resolver->expects($this->once()) - ->method('resolve') - ->with('foo') - ->will($this->returnValue($resolvedLoader)); - - $loader = new ProjectLoader1(); - $loader->setResolver($resolver); - - $this->assertEquals('yes', $loader->import('foo')); - } - - public function testImportWithType() - { - $resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); - $resolvedLoader->expects($this->once()) - ->method('load') - ->with('foo', 'bar') - ->will($this->returnValue('yes')); - - $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); - $resolver->expects($this->once()) - ->method('resolve') - ->with('foo', 'bar') - ->will($this->returnValue($resolvedLoader)); - - $loader = new ProjectLoader1(); - $loader->setResolver($resolver); - - $this->assertEquals('yes', $loader->import('foo', 'bar')); - } -} - -class ProjectLoader1 extends Loader -{ - public function load($resource, $type = null) - { - } - - public function supports($resource, $type = null) - { - return is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); - } - - public function getType() - { - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php deleted file mode 100644 index d78e0cf..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Resource; - -use Symfony\Component\Config\Resource\DirectoryResource; - -class DirectoryResourceTest extends \PHPUnit_Framework_TestCase -{ - protected $directory; - - protected function setUp() - { - $this->directory = sys_get_temp_dir().'/symfonyDirectoryIterator'; - if (!file_exists($this->directory)) { - mkdir($this->directory); - } - touch($this->directory.'/tmp.xml'); - } - - protected function tearDown() - { - if (!is_dir($this->directory)) { - return; - } - $this->removeDirectory($this->directory); - } - - protected function removeDirectory($directory) - { - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory), \RecursiveIteratorIterator::CHILD_FIRST); - foreach ($iterator as $path) { - if (preg_match('#[/\\\\]\.\.?$#', $path->__toString())) { - continue; - } - if ($path->isDir()) { - rmdir($path->__toString()); - } else { - unlink($path->__toString()); - } - } - rmdir($directory); - } - - public function testGetResource() - { - $resource = new DirectoryResource($this->directory); - $this->assertSame($this->directory, $resource->getResource(), '->getResource() returns the path to the resource'); - $this->assertSame($this->directory, (string) $resource, '->__toString() returns the path to the resource'); - } - - public function testGetPattern() - { - $resource = new DirectoryResource('foo', 'bar'); - $this->assertEquals('bar', $resource->getPattern()); - } - - public function testIsFresh() - { - $resource = new DirectoryResource($this->directory); - $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if the resource has not changed'); - $this->assertFalse($resource->isFresh(time() - 86400), '->isFresh() returns false if the resource has been updated'); - - $resource = new DirectoryResource('/____foo/foobar'.rand(1, 999999)); - $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the resource does not exist'); - } - - public function testIsFreshUpdateFile() - { - $resource = new DirectoryResource($this->directory); - touch($this->directory.'/tmp.xml', time() + 20); - $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if an existing file is modified'); - } - - public function testIsFreshNewFile() - { - $resource = new DirectoryResource($this->directory); - touch($this->directory.'/new.xml', time() + 20); - $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a new file is added'); - } - - public function testIsFreshDeleteFile() - { - $resource = new DirectoryResource($this->directory); - unlink($this->directory.'/tmp.xml'); - $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if an existing file is removed'); - } - - public function testIsFreshDeleteDirectory() - { - $resource = new DirectoryResource($this->directory); - $this->removeDirectory($this->directory); - $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the whole resource is removed'); - } - - public function testIsFreshCreateFileInSubdirectory() - { - $subdirectory = $this->directory.'/subdirectory'; - mkdir($subdirectory); - - $resource = new DirectoryResource($this->directory); - $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if an unmodified subdirectory exists'); - - touch($subdirectory.'/newfile.xml', time() + 20); - $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a new file in a subdirectory is added'); - } - - public function testIsFreshModifySubdirectory() - { - $resource = new DirectoryResource($this->directory); - - $subdirectory = $this->directory.'/subdirectory'; - mkdir($subdirectory); - touch($subdirectory, time() + 20); - - $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a subdirectory is modified (e.g. a file gets deleted)'); - } - - public function testFilterRegexListNoMatch() - { - $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); - - touch($this->directory.'/new.bar', time() + 20); - $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if a new file not matching the filter regex is created'); - } - - public function testFilterRegexListMatch() - { - $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); - - touch($this->directory.'/new.xml', time() + 20); - $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if an new file matching the filter regex is created '); - } - - public function testSerializeUnserialize() - { - $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); - - $unserialized = unserialize(serialize($resource)); - - $this->assertSame($this->directory, $resource->getResource()); - $this->assertSame('/\.(foo|xml)$/', $resource->getPattern()); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/FileResourceTest.php deleted file mode 100644 index d152806..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/FileResourceTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Resource; - -use Symfony\Component\Config\Resource\FileResource; - -class FileResourceTest extends \PHPUnit_Framework_TestCase -{ - protected $resource; - protected $file; - protected $time; - - protected function setUp() - { - $this->file = realpath(sys_get_temp_dir()).'/tmp.xml'; - $this->time = time(); - touch($this->file, $this->time); - $this->resource = new FileResource($this->file); - } - - protected function tearDown() - { - unlink($this->file); - } - - public function testGetResource() - { - $this->assertSame(realpath($this->file), $this->resource->getResource(), '->getResource() returns the path to the resource'); - } - - public function testToString() - { - $this->assertSame(realpath($this->file), (string) $this->resource); - } - - public function testIsFresh() - { - $this->assertTrue($this->resource->isFresh($this->time), '->isFresh() returns true if the resource has not changed in same second'); - $this->assertTrue($this->resource->isFresh($this->time + 10), '->isFresh() returns true if the resource has not changed'); - $this->assertFalse($this->resource->isFresh($this->time - 86400), '->isFresh() returns false if the resource has been updated'); - - $resource = new FileResource('/____foo/foobar'.rand(1, 999999)); - $this->assertFalse($resource->isFresh($this->time), '->isFresh() returns false if the resource does not exist'); - } - - public function testSerializeUnserialize() - { - $unserialized = unserialize(serialize($this->resource)); - - $this->assertSame(realpath($this->file), $this->resource->getResource()); - } -} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php deleted file mode 100644 index f9d3d14..0000000 --- a/vendor/symfony/config/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ /dev/null @@ -1,197 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Tests\Loader; - -use Symfony\Component\Config\Util\XmlUtils; - -class XmlUtilsTest extends \PHPUnit_Framework_TestCase -{ - public function testLoadFile() - { - $fixtures = __DIR__.'/../Fixtures/Util/'; - - try { - XmlUtils::loadFile($fixtures.'invalid.xml'); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertContains('ERROR 77', $e->getMessage()); - } - - try { - XmlUtils::loadFile($fixtures.'document_type.xml'); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertContains('Document types are not allowed', $e->getMessage()); - } - - try { - XmlUtils::loadFile($fixtures.'invalid_schema.xml', $fixtures.'schema.xsd'); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertContains('ERROR 1845', $e->getMessage()); - } - - try { - XmlUtils::loadFile($fixtures.'invalid_schema.xml', 'invalid_callback_or_file'); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertContains('XSD file or callable', $e->getMessage()); - } - - $mock = $this->getMock(__NAMESPACE__.'\Validator'); - $mock->expects($this->exactly(2))->method('validate')->will($this->onConsecutiveCalls(false, true)); - - try { - XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate')); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertContains('is not valid', $e->getMessage()); - } - - $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate'))); - $this->assertSame(array(), libxml_get_errors()); - } - - public function testLoadFileWithInternalErrorsEnabled() - { - libxml_use_internal_errors(true); - - $this->assertSame(array(), libxml_get_errors()); - $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/invalid_schema.xml')); - $this->assertSame(array(), libxml_get_errors()); - } - - /** - * @dataProvider getDataForConvertDomToArray - */ - public function testConvertDomToArray($expected, $xml, $root = false, $checkPrefix = true) - { - $dom = new \DOMDocument(); - $dom->loadXML($root ? $xml : '<root>'.$xml.'</root>'); - - $this->assertSame($expected, XmlUtils::convertDomElementToArray($dom->documentElement, $checkPrefix)); - } - - public function getDataForConvertDomToArray() - { - return array( - array(null, ''), - array('bar', 'bar'), - array(array('bar' => 'foobar'), '<foo bar="foobar" />', true), - array(array('foo' => null), '<foo />'), - array(array('foo' => 'bar'), '<foo>bar</foo>'), - array(array('foo' => array('foo' => 'bar')), '<foo foo="bar"/>'), - array(array('foo' => array('foo' => 0)), '<foo><foo>0</foo></foo>'), - array(array('foo' => array('foo' => 'bar')), '<foo><foo>bar</foo></foo>'), - array(array('foo' => array('foo' => 'bar', 'value' => 'text')), '<foo foo="bar">text</foo>'), - array(array('foo' => array('attr' => 'bar', 'foo' => 'text')), '<foo attr="bar"><foo>text</foo></foo>'), - array(array('foo' => array('bar', 'text')), '<foo>bar</foo><foo>text</foo>'), - array(array('foo' => array(array('foo' => 'bar'), array('foo' => 'text'))), '<foo foo="bar"/><foo foo="text" />'), - array(array('foo' => array('foo' => array('bar', 'text'))), '<foo foo="bar"><foo>text</foo></foo>'), - array(array('foo' => 'bar'), '<foo><!-- Comment -->bar</foo>'), - array(array('foo' => 'text'), '<foo xmlns:h="http://www.example.org/bar" h:bar="bar">text</foo>'), - array(array('foo' => array('bar' => 'bar', 'value' => 'text')), '<foo xmlns:h="http://www.example.org/bar" h:bar="bar">text</foo>', false, false), - array(array('attr' => 1, 'b' => 'hello'), '<foo:a xmlns:foo="http://www.example.org/foo" xmlns:h="http://www.example.org/bar" attr="1" h:bar="bar"><foo:b>hello</foo:b><h:c>2</h:c></foo:a>', true), - ); - } - - /** - * @dataProvider getDataForPhpize - */ - public function testPhpize($expected, $value) - { - $this->assertSame($expected, XmlUtils::phpize($value)); - } - - public function getDataForPhpize() - { - return array( - array('', ''), - array(null, 'null'), - array(true, 'true'), - array(false, 'false'), - array(null, 'Null'), - array(true, 'True'), - array(false, 'False'), - array(0, '0'), - array(1, '1'), - array(-1, '-1'), - array(0777, '0777'), - array(255, '0xFF'), - array(100.0, '1e2'), - array(-120.0, '-1.2E2'), - array(-10100.1, '-10100.1'), - array('-10,100.1', '-10,100.1'), - array('1234 5678 9101 1121 3141', '1234 5678 9101 1121 3141'), - array('1,2,3,4', '1,2,3,4'), - array('11,22,33,44', '11,22,33,44'), - array('11,222,333,4', '11,222,333,4'), - array('1,222,333,444', '1,222,333,444'), - array('11,222,333,444', '11,222,333,444'), - array('111,222,333,444', '111,222,333,444'), - array('1111,2222,3333,4444,5555', '1111,2222,3333,4444,5555'), - array('foo', 'foo'), - array(6, '0b0110'), - ); - } - - public function testLoadEmptyXmlFile() - { - $file = __DIR__.'/../Fixtures/foo.xml'; - $this->setExpectedException('InvalidArgumentException', 'File '.$file.' does not contain valid XML, it is empty.'); - XmlUtils::loadFile($file); - } - - // test for issue https://github.com/symfony/symfony/issues/9731 - public function testLoadWrongEmptyXMLWithErrorHandler() - { - $originalDisableEntities = libxml_disable_entity_loader(false); - $errorReporting = error_reporting(-1); - - set_error_handler(function ($errno, $errstr) { - throw new \Exception($errstr, $errno); - }); - - $file = __DIR__.'/../Fixtures/foo.xml'; - try { - try { - XmlUtils::loadFile($file); - $this->fail('An exception should have been raised'); - } catch (\InvalidArgumentException $e) { - $this->assertEquals(sprintf('File %s does not contain valid XML, it is empty.', $file), $e->getMessage()); - } - } catch (\Exception $e) { - restore_error_handler(); - error_reporting($errorReporting); - - throw $e; - } - - restore_error_handler(); - error_reporting($errorReporting); - - $disableEntities = libxml_disable_entity_loader(true); - libxml_disable_entity_loader($disableEntities); - - libxml_disable_entity_loader($originalDisableEntities); - - $this->assertFalse($disableEntities); - - // should not throw an exception - XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/valid.xml', __DIR__.'/../Fixtures/Util/schema.xsd'); - } -} - -interface Validator -{ - public function validate(); -} |
