X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fconfig%2FTests%2FDefinition%2FBuilder%2FExprBuilderTest.php;h=99a10413768b484246394a1e16db2f1d0ef60be2;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=1b90ebfeb82bcace7bc37af959d3dfaf57e1e75c;hpb=eba34333e3c89f208d2f72fa91351ad019a71583;p=yaffs-website diff --git a/vendor/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php b/vendor/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php index 1b90ebfeb..99a104137 100644 --- a/vendor/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php +++ b/vendor/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php @@ -76,6 +76,21 @@ class ExprBuilderTest extends TestCase $this->assertFinalizedValueIs('value', $test); } + public function testIfEmptyExpression() + { + $test = $this->getTestBuilder() + ->ifEmpty() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test, array('key' => array())); + + $test = $this->getTestBuilder() + ->ifEmpty() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + public function testIfArrayExpression() { $test = $this->getTestBuilder() @@ -130,6 +145,25 @@ class ExprBuilderTest extends TestCase $this->assertFinalizedValueIs(array(), $test); } + /** + * @dataProvider castToArrayValues + */ + public function testcastToArrayExpression($configValue, $expectedValue) + { + $test = $this->getTestBuilder() + ->castToArray() + ->end(); + $this->assertFinalizedValueIs($expectedValue, $test, array('key' => $configValue)); + } + + public function castToArrayValues() + { + yield array('value', array('value')); + yield array(-3.14, array(-3.14)); + yield array(null, array(null)); + yield array(array('value'), array('value')); + } + /** * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException */