Skip to content

Commit 9c780b6

Browse files
Merge branch '3.2'
* 3.2: Refactored other PHPUnit method calls to work with namespaced PHPUnit 6 Refactored other PHPUnit method calls to work with namespaced PHPUnit 6 Further refactorings to PHPUnit namespaces resolve parameters in definition classes
2 parents 634bd87 + a2c48cd commit 9c780b6

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

Tests/Definition/ArrayNodeTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ public function ignoreAndRemoveMatrixProvider()
5555
public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $message = '')
5656
{
5757
if ($expected instanceof \Exception) {
58-
$this->setExpectedException(get_class($expected), $expected->getMessage());
58+
if (method_exists($this, 'expectException')) {
59+
$this->expectException(get_class($expected));
60+
$this->expectExceptionMessage($expected->getMessage());
61+
} else {
62+
$this->setExpectedException(get_class($expected), $expected->getMessage());
63+
}
5964
}
6065
$node = new ArrayNode('root');
6166
$node->setIgnoreExtraKeys($ignore, $remove);

Tests/Definition/ScalarNodeTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ public function testNormalizeThrowsExceptionWithoutHint()
6363
{
6464
$node = new ScalarNode('test');
6565

66-
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.');
66+
if (method_exists($this, 'expectException')) {
67+
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
68+
$this->expectExceptionMessage('Invalid type for path "test". Expected scalar, but got array.');
69+
} else {
70+
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.');
71+
}
6772

6873
$node->normalize(array());
6974
}
@@ -73,7 +78,12 @@ public function testNormalizeThrowsExceptionWithErrorMessage()
7378
$node = new ScalarNode('test');
7479
$node->setInfo('"the test value"');
7580

76-
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
81+
if (method_exists($this, 'expectException')) {
82+
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
83+
$this->expectExceptionMessage("Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
84+
} else {
85+
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
86+
}
7787

7888
$node->normalize(array());
7989
}

Tests/Util/XmlUtilsTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ public function getDataForPhpize()
151151
public function testLoadEmptyXmlFile()
152152
{
153153
$file = __DIR__.'/../Fixtures/foo.xml';
154-
$this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file));
154+
155+
if (method_exists($this, 'expectException')) {
156+
$this->expectException('InvalidArgumentException');
157+
$this->expectExceptionMessage(sprintf('File %s does not contain valid XML, it is empty.', $file));
158+
} else {
159+
$this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file));
160+
}
161+
155162
XmlUtils::loadFile($file);
156163
}
157164

0 commit comments

Comments
 (0)