Skip to content

Instantly share code, notes, and snippets.

@alexislefebvre
Last active May 31, 2017 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexislefebvre/c439db16d52e0cc7a116417e7f7ccec9 to your computer and use it in GitHub Desktop.
Save alexislefebvre/c439db16d52e0cc7a116417e7f7ccec9 to your computer and use it in GitHub Desktop.
diff --git a/Test/ValidationErrorsConstraint.php b/Test/ValidationErrorsConstraint.php
index 7b494f9..ad7656e 100644
--- a/Test/ValidationErrorsConstraint.php
+++ b/Test/ValidationErrorsConstraint.php
@@ -12,9 +12,10 @@
namespace Liip\FunctionalTestBundle\Test;
// BC
-class_alias('\PHPUnit_Framework_Constraint', '\PHPUnit\Framework\Constraint\Constraint');
+//class_alias('\PHPUnit_Framework_Constraint', '\PHPUnit\Framework\Constraint\Constraint');
use PHPUnit\Framework\Constraint\Constraint;
+use PHPUnit\Framework\ExpectationFailedException;
use Symfony\Component\Validator\ConstraintViolationList;
class ValidationErrorsConstraint extends Constraint
@@ -77,7 +78,7 @@ class ValidationErrorsConstraint extends Constraint
}
}
- throw new \PHPUnit_Framework_ExpectationFailedException(
+ throw new ExpectationFailedException(
$description."\n".implode("\n", $lines)
);
}
diff --git a/Tests/Command/CommandTest.php b/Tests/Command/CommandTest.php
index e94d94e..d13d964 100644
--- a/Tests/Command/CommandTest.php
+++ b/Tests/Command/CommandTest.php
@@ -187,14 +187,13 @@ class CommandTest extends WebTestCase
$this->assertContains('Verbosity level: DEBUG', $this->display);
}
+ /**
+ * @expectedException \OutOfBoundsException
+ */
public function testRunCommandVerbosityOutOfBound()
{
$this->setVerbosityLevel('foobar');
- $this->setExpectedException(
- 'OutOfBoundsException'
- );
-
$this->runCommand('command:test');
}
diff --git a/Tests/Test/Html5WebTestCaseMockTest.php b/Tests/Test/Html5WebTestCaseMockTest.php
index 6c4e593..3503b23 100644
--- a/Tests/Test/Html5WebTestCaseMockTest.php
+++ b/Tests/Test/Html5WebTestCaseMockTest.php
@@ -13,7 +13,9 @@ namespace Liip\FunctionalTestBundle\Tests\Test;
/* Used by annotations */
use Liip\FunctionalTestBundle\Test\Html5WebTestCase;
+use PHPUnit\Framework\SkippedTestError;
use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\AssertionFailedError;
/**
* Test Html5WebTestCase class with mocked methods instead of inheriting from
@@ -136,7 +138,7 @@ EOF;
try {
$mock->assertIsValidHtml5('baz');
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (AssertionFailedError $e) {
$this->assertSame($string, $e->getMessage());
return;
@@ -192,7 +194,7 @@ EOF;
try {
$mock->assertIsValidHtml5('', 'baz');
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (AssertionFailedError $e) {
$this->assertSame($string, $e->getMessage());
return;
@@ -214,7 +216,7 @@ EOF;
try {
$mock->assertIsValidHtml5('');
- } catch (\PHPUnit_Framework_SkippedTestError $e) {
+ } catch (SkippedTestError $e) {
$this->assertSame(
'HTML5 Validator service not found at \'http://localhost/\' !',
$e->getMessage()
@@ -246,7 +248,7 @@ EOF;
try {
$mock->assertIsValidHtml5('');
- } catch (\PHPUnit_Framework_SkippedTestError $e) {
+ } catch (SkippedTestError $e) {
$this->assertSame(
'HTML5 Validator service not found at \'http://localhost/\' !',
$e->getMessage()
@@ -277,7 +279,7 @@ EOF;
}
/**
- * @expectedException \PHPUnit_Framework_AssertionFailedError
+ * @expectedException \PHPUnit\Framework\AssertionFailedError
*/
public function testAssertIsValidHtml5SnippetFail()
{
diff --git a/Tests/Test/WebTestCaseTest.php b/Tests/Test/WebTestCaseTest.php
index 03fefcf..e1b0183 100644
--- a/Tests/Test/WebTestCaseTest.php
+++ b/Tests/Test/WebTestCaseTest.php
@@ -12,6 +12,7 @@
namespace Liip\FunctionalTestBundle\Tests\Test;
use Liip\FunctionalTestBundle\Test\WebTestCase;
+use PHPUnit\Framework\AssertionFailedError;
class WebTestCaseTest extends WebTestCase
{
@@ -116,7 +117,7 @@ class WebTestCaseTest extends WebTestCase
try {
$this->assertStatusCode(-1, $this->client);
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (AssertionFailedError $e) {
$this->assertStringStartsWith(
'HTTP/1.1 200 OK',
$e->getMessage()
@@ -146,7 +147,7 @@ class WebTestCaseTest extends WebTestCase
try {
$this->assertStatusCode(-1, $this->client);
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (AssertionFailedError $e) {
$string = <<<'EOF'
No user found
Failed asserting that 404 matches expected -1.
@@ -254,7 +255,7 @@ EOF;
try {
$this->isSuccessful($response);
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (AssertionFailedError $e) {
$string = <<<'EOF'
The Response was not successful: foo
Failed asserting that false is true.
@@ -611,7 +612,7 @@ EOF;
/**
* @depends testForm
*
- * @expectedException \PHPUnit_Framework_ExpectationFailedException
+ * @expectedException \PHPUnit\Framework\ExpectationFailedException
*/
public function testFormWithException()
{
@@ -657,7 +658,7 @@ EOF;
try {
$this->assertStatusCode(-1, $this->client);
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (AssertionFailedError $e) {
$string = <<<'EOF'
Unexpected validation errors:
+ children[name].data: This value should not be blank.
@alexislefebvre
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment