replace deprecated PHPUnit code

This commit is contained in:
Daniel Seifert 2024-06-16 14:10:22 +02:00
parent 5e1b4e2110
commit b5a7571a95
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
2 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,7 @@ use D3\TestingTools\Development\CanAccessRestricted;
use D3\TestingTools\Production\IsMockable;
use D3\TestingTools\Tests\Unit\Production\HelperClasses\IsMockableClass;
use D3\TestingTools\Tests\Unit\Production\HelperClasses\IsMockableParent;
use Exception;
use Generator;
use OxidEsales\Eshop\Application\Model\Article;
use PHPUnit\Framework\MockObject\MockObject;
@ -38,19 +39,25 @@ class IsMockableTest extends TestCase
*/
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();
$argument = $this->getRandomString();
$traitMock = $this->getObjectForTrait(IsMockable::class);
// argument #1 is not a valid callable
$this->expectError();
$this->expectExceptionMessage('must be of type callable, array given');
$this->callMethod(
$traitMock,
'd3CallMockableFunction',
[[$traitMock, $methodName], [$argument]]
);
restore_error_handler();
}
/**

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true"
bootstrap="../../../../source/bootstrap.php"
bootstrap="../../../source/bootstrap.php"
colors="false"
backupStaticAttributes="false"
convertErrorsToExceptions="true"