Skip to content

Commit 3688bfa

Browse files
Merge branch '2.7' into 2.8
* 2.7: Further refactorings to PHPUnit namespaces resolve parameters in definition classes
2 parents f793d0f + 316c571 commit 3688bfa

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

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)