replace deprecated PHPUnit code
This commit is contained in:
parent
5e1b4e2110
commit
b5a7571a95
|
@ -21,6 +21,7 @@ use D3\TestingTools\Development\CanAccessRestricted;
|
||||||
use D3\TestingTools\Production\IsMockable;
|
use D3\TestingTools\Production\IsMockable;
|
||||||
use D3\TestingTools\Tests\Unit\Production\HelperClasses\IsMockableClass;
|
use D3\TestingTools\Tests\Unit\Production\HelperClasses\IsMockableClass;
|
||||||
use D3\TestingTools\Tests\Unit\Production\HelperClasses\IsMockableParent;
|
use D3\TestingTools\Tests\Unit\Production\HelperClasses\IsMockableParent;
|
||||||
|
use Exception;
|
||||||
use Generator;
|
use Generator;
|
||||||
use OxidEsales\Eshop\Application\Model\Article;
|
use OxidEsales\Eshop\Application\Model\Article;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
|
@ -38,19 +39,25 @@ class IsMockableTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function callMockableFunctionMissingFunction(): void
|
public function callMockableFunctionMissingFunction(): void
|
||||||
{
|
{
|
||||||
|
set_error_handler(static function (int $errno, string $errstr): void {
|
||||||
|
throw new Exception($errstr, $errno);
|
||||||
|
}, E_USER_WARNING);
|
||||||
|
|
||||||
$methodName = $this->getRandomString();
|
$methodName = $this->getRandomString();
|
||||||
$argument = $this->getRandomString();
|
$argument = $this->getRandomString();
|
||||||
|
|
||||||
$traitMock = $this->getObjectForTrait(IsMockable::class);
|
$traitMock = $this->getObjectForTrait(IsMockable::class);
|
||||||
|
|
||||||
// argument #1 is not a valid callable
|
// argument #1 is not a valid callable
|
||||||
$this->expectError();
|
$this->expectExceptionMessage('must be of type callable, array given');
|
||||||
|
|
||||||
$this->callMethod(
|
$this->callMethod(
|
||||||
$traitMock,
|
$traitMock,
|
||||||
'd3CallMockableFunction',
|
'd3CallMockableFunction',
|
||||||
[[$traitMock, $methodName], [$argument]]
|
[[$traitMock, $methodName], [$argument]]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
restore_error_handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
backupGlobals="true"
|
backupGlobals="true"
|
||||||
bootstrap="../../../../source/bootstrap.php"
|
bootstrap="../../../source/bootstrap.php"
|
||||||
colors="false"
|
colors="false"
|
||||||
backupStaticAttributes="false"
|
backupStaticAttributes="false"
|
||||||
convertErrorsToExceptions="true"
|
convertErrorsToExceptions="true"
|
||||||
|
|
Loading…
Reference in New Issue