"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "public_html/lists/base/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php" between
phplist-3.4.5.tgz and phplist-3.4.6.tgz

About: phpList is a one-way email announcement delivery system for newsletters, publicity lists, notifications, and many other uses (requires PHP and MySQL).

ArrayNodeTest.php  (phplist-3.4.5.tgz):ArrayNodeTest.php  (phplist-3.4.6.tgz)
skipping to change at line 21 skipping to change at line 21
namespace Symfony\Component\Config\Tests\Definition; namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\ArrayNode; use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\ScalarNode; use Symfony\Component\Config\Definition\ScalarNode;
class ArrayNodeTest extends TestCase class ArrayNodeTest extends TestCase
{ {
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\Invalid
TypeException
*/
public function testNormalizeThrowsExceptionWhenFalseIsNotAllowed() public function testNormalizeThrowsExceptionWhenFalseIsNotAllowed()
{ {
$this->expectException('Symfony\Component\Config\Definition\Exception\In validTypeException');
$node = new ArrayNode('root'); $node = new ArrayNode('root');
$node->normalize(false); $node->normalize(false);
} }
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\
InvalidConfigurationException
* @expectedExceptionMessage Unrecognized option "foo" under "root"
*/
public function testExceptionThrownOnUnrecognizedChild() public function testExceptionThrownOnUnrecognizedChild()
{ {
$this->expectException('Symfony\Component\Config\Definition\Exception\In
validConfigurationException');
$this->expectExceptionMessage('Unrecognized option "foo" under "root"');
$node = new ArrayNode('root'); $node = new ArrayNode('root');
$node->normalize(['foo' => 'bar']); $node->normalize(['foo' => 'bar']);
} }
public function ignoreAndRemoveMatrixProvider() public function ignoreAndRemoveMatrixProvider()
{ {
$unrecognizedOptionException = new InvalidConfigurationException('Unreco gnized option "foo" under "root"'); $unrecognizedOptionException = new InvalidConfigurationException('Unreco gnized option "foo" under "root"');
return [ return [
[true, true, [], 'no exception is thrown for an unrecognized child i f the ignoreExtraKeys option is set to true'], [true, true, [], 'no exception is thrown for an unrecognized child i f the ignoreExtraKeys option is set to true'],
skipping to change at line 58 skipping to change at line 54
[false, false, $unrecognizedOptionException], [false, false, $unrecognizedOptionException],
]; ];
} }
/** /**
* @dataProvider ignoreAndRemoveMatrixProvider * @dataProvider ignoreAndRemoveMatrixProvider
*/ */
public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $m essage = '') public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $m essage = '')
{ {
if ($expected instanceof \Exception) { if ($expected instanceof \Exception) {
if (method_exists($this, 'expectException')) { $this->expectException(\get_class($expected));
$this->expectException(\get_class($expected)); $this->expectExceptionMessage($expected->getMessage());
$this->expectExceptionMessage($expected->getMessage());
} else {
$this->setExpectedException(\get_class($expected), $expected->ge
tMessage());
}
} }
$node = new ArrayNode('root'); $node = new ArrayNode('root');
$node->setIgnoreExtraKeys($ignore, $remove); $node->setIgnoreExtraKeys($ignore, $remove);
$result = $node->normalize(['foo' => 'bar']); $result = $node->normalize(['foo' => 'bar']);
$this->assertSame($expected, $result, $message); $this->assertSame($expected, $result, $message);
} }
/** /**
* @dataProvider getPreNormalizationTests * @dataProvider getPreNormalizationTests
*/ */
skipping to change at line 183 skipping to change at line 175
public function getPreNormalizedNormalizedOrderedData() public function getPreNormalizedNormalizedOrderedData()
{ {
return [ return [
[ [
['2' => 'two', '1' => 'one', '3' => 'three'], ['2' => 'two', '1' => 'one', '3' => 'three'],
['2' => 'two', '1' => 'one', '3' => 'three'], ['2' => 'two', '1' => 'one', '3' => 'three'],
], ],
]; ];
} }
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Child nodes must be named.
*/
public function testAddChildEmptyName() public function testAddChildEmptyName()
{ {
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Child nodes must be named.');
$node = new ArrayNode('root'); $node = new ArrayNode('root');
$childNode = new ArrayNode(''); $childNode = new ArrayNode('');
$node->addChild($childNode); $node->addChild($childNode);
} }
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage A child node named "foo" already exists.
*/
public function testAddChildNameAlreadyExists() public function testAddChildNameAlreadyExists()
{ {
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('A child node named "foo" already exists.'
);
$node = new ArrayNode('root'); $node = new ArrayNode('root');
$childNode = new ArrayNode('foo'); $childNode = new ArrayNode('foo');
$node->addChild($childNode); $node->addChild($childNode);
$childNodeWithSameName = new ArrayNode('foo'); $childNodeWithSameName = new ArrayNode('foo');
$node->addChild($childNodeWithSameName); $node->addChild($childNodeWithSameName);
} }
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage The node at path "foo" has no default value.
*/
public function testGetDefaultValueWithoutDefaultValue() public function testGetDefaultValueWithoutDefaultValue()
{ {
$this->expectException('RuntimeException');
$this->expectExceptionMessage('The node at path "foo" has no default val
ue.');
$node = new ArrayNode('foo'); $node = new ArrayNode('foo');
$node->getDefaultValue(); $node->getDefaultValue();
} }
public function testSetDeprecated() public function testSetDeprecated()
{ {
$childNode = new ArrayNode('foo'); $childNode = new ArrayNode('foo');
$childNode->setDeprecated('"%node%" is deprecated'); $childNode->setDeprecated('"%node%" is deprecated');
$this->assertTrue($childNode->isDeprecated()); $this->assertTrue($childNode->isDeprecated());
 End of changes. 11 change blocks. 
28 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)