Skip to content

Commit 522af13

Browse files
peterrehmnicolas-grekas
authored andcommitted
Further refactorings to PHPUnit namespaces
1 parent 02d9d19 commit 522af13

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Tests/FinderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ public function testAccessDeniedException()
689689
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
690690
}
691691

692+
if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
693+
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, '\PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
694+
}
695+
692696
$this->assertInstanceOf($expectedExceptionClass, $e);
693697
}
694698
}

Tests/Shell/CommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testInsDuplicateLabelException()
103103
$cmd = Command::create()->add('--force');
104104

105105
$cmd->ins('label');
106-
$this->setExpectedException('RuntimeException');
106+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('RuntimeException');
107107
$cmd->ins('label');
108108
}
109109

@@ -119,15 +119,15 @@ public function testEndNoParentException()
119119
{
120120
$cmd = Command::create();
121121

122-
$this->setExpectedException('RuntimeException');
122+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('RuntimeException');
123123
$cmd->end();
124124
}
125125

126126
public function testGetMissingLabelException()
127127
{
128128
$cmd = Command::create();
129129

130-
$this->setExpectedException('RuntimeException');
130+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('RuntimeException');
131131
$cmd->get('invalid');
132132
}
133133

0 commit comments

Comments
 (0)