replace deprecated PHPUnit code

Cette révision appartient à :
Daniel Seifert 2024-06-16 14:10:22 +02:00
Parent 5e1b4e2110
révision b5a7571a95
Signé par: DanielS
ID de la clé GPG: 6A513E13AEE66170
2 fichiers modifiés avec 9 ajouts et 2 suppressions

Voir le fichier

@ -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();
}
/**

Voir le fichier

@ -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"