From c2cef0d8f435e0a8cfdf03b5fef3e0e916aca9e0 Mon Sep 17 00:00:00 2001 From: Andy Wendt Date: Tue, 3 Feb 2015 08:45:28 -0700 Subject: [PATCH] Replaced phpunit mocks of exception with concretions so they will work in hhvm --- tests/Exceptions/AbstractNestedExceptionTest.php | 12 +++++++++++- tests/Exceptions/CheckExceptionsTest.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/Exceptions/AbstractNestedExceptionTest.php b/tests/Exceptions/AbstractNestedExceptionTest.php index 98173f88..fd0f0b1a 100644 --- a/tests/Exceptions/AbstractNestedExceptionTest.php +++ b/tests/Exceptions/AbstractNestedExceptionTest.php @@ -3,11 +3,21 @@ namespace Respect\Validation\Exceptions; use Respect\Validation\Validator as v; +/** + * Class PrivateAbstractNestedException + * @package Respect\Validation\Exceptions + * phpunit has an issue with mocking exceptions when in HHVM: + * https://github.com/sebastianbergmann/phpunit-mock-objects/issues/207 + */ +class PrivateAbstractNestedException extends AbstractNestedException +{ +} + class AbstractNestedExceptionTest extends \PHPUnit_Framework_TestCase { public function testItImplementsNestedValidationExceptionInterface() { - $abstractNestedException = $this->getMock('Respect\Validation\Exceptions\AbstractNestedException'); + $abstractNestedException = new PrivateAbstractNestedException(); $this->assertInstanceOf('Respect\Validation\Exceptions\NestedValidationExceptionInterface', $abstractNestedException); } diff --git a/tests/Exceptions/CheckExceptionsTest.php b/tests/Exceptions/CheckExceptionsTest.php index 7fb5b48b..b6ec14c4 100644 --- a/tests/Exceptions/CheckExceptionsTest.php +++ b/tests/Exceptions/CheckExceptionsTest.php @@ -64,7 +64,7 @@ class CheckExceptionsTest extends \PHPUnit_Framework_TestCase foreach ($this->getAllRuleNames() as $ruleName) { $exceptionClass = $this->buildExceptionClass($ruleName); - $exceptionClassMock = $this->getMock($exceptionClass); + $exceptionClassMock = new $exceptionClass(); if ($exceptionClassMock instanceof ValidationExceptionInterface) { continue; }