diff --git a/src/Test/TestCase.php b/src/Test/TestCase.php index dc5644b..d1e5be2 100644 --- a/src/Test/TestCase.php +++ b/src/Test/TestCase.php @@ -5,35 +5,54 @@ namespace Retailcrm\Retailcrm\Test; // backward compatibility with phpunit < v.6 if (!class_exists('\PHPUnit\Framework\TestCase')) { class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); -} -abstract class TestCase extends \PHPUnit\Framework\TestCase -{ - protected function createMock($originalClassName) + abstract class TestCase extends \PHPUnit\Framework\TestCase { - if (method_exists(\PHPUnit\Framework\TestCase::class, 'createMock')) { - return parent::createMock($originalClassName); - } else { - return $this->getMockBuilder($originalClassName) - ->disableOriginalConstructor() - ->disableOriginalClone() - ->disableArgumentCloning() - ->getMock(); + public function createMock($originalClassName) + { + if (method_exists(\PHPUnit\Framework\TestCase::class, 'createMock')) { + return parent::createMock($originalClassName); + } else { + return $this->getMockBuilder($originalClassName) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->getMock(); + } } - } - protected function createPartialMock($originalClassName, $methods) - { - if (method_exists(\PHPUnit\Framework\TestCase::class, 'createPartialMock')) { - return parent::createMock($originalClassName); - } else { - return $this->getMockBuilder($originalClassName) - ->disableOriginalConstructor() - ->disableOriginalClone() - ->disableArgumentCloning() + protected function createPartialMock($originalClassName, $methods) + { + if (method_exists(\PHPUnit\Framework\TestCase::class, 'createPartialMock')) { + return parent::createMock($originalClassName); + } else { + return $this->getMockBuilder($originalClassName) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() // ->disallowMockingUnknownTypes() - ->setMethods(empty($methods) ? null : $methods) - ->getMock(); + ->setMethods(empty($methods) ? null : $methods) + ->getMock(); + } + } + } +} else { + + abstract class TestCase extends \PHPUnit\Framework\TestCase + { + public function createMock($originalClassName) + { + if (method_exists(\PHPUnit\Framework\TestCase::class, 'createMock')) { + return parent::createMock($originalClassName); + } else { + return $this->getMockBuilder($originalClassName) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->getMock(); + } } } } + +