diff --git a/src/test/php/unittest/assert/unittest/AssertTest.class.php b/src/test/php/unittest/assert/unittest/AssertTest.class.php index d6244e9..aaf50ec 100755 --- a/src/test/php/unittest/assert/unittest/AssertTest.class.php +++ b/src/test/php/unittest/assert/unittest/AssertTest.class.php @@ -50,9 +50,9 @@ public function execute_all_assertions() { public function even_inside_allof_execution_stops_at_first_failure() { try { All::of(function() { - Assert::that('Hello')->isEmpty()->is(newinstance(Condition::class, [], [ - 'matches' => function($value) { throw new IllegalStateException('Unreachable'); } - ])); + Assert::that('Hello')->isEmpty()->is(new class() extends Condition { + public function matches($value) { throw new IllegalStateException('Unreachable'); } + }); }); } catch (AssertionFailedError $expected) { return; diff --git a/src/test/php/unittest/assert/unittest/ConditionAssertionsTest.class.php b/src/test/php/unittest/assert/unittest/ConditionAssertionsTest.class.php index 38bf1f8..2543280 100755 --- a/src/test/php/unittest/assert/unittest/ConditionAssertionsTest.class.php +++ b/src/test/php/unittest/assert/unittest/ConditionAssertionsTest.class.php @@ -9,15 +9,15 @@ class ConditionAssertionsTest extends AbstractAssertionsTest { #[@test] public function is_a_test() { - $this->assertVerified(Assertions::of('Test')->is(newinstance(Condition::class, [], [ - 'matches' => function($value) { return 'Test' === $value; } - ]))); + $this->assertVerified(Assertions::of('Test')->is(new class() extends Condition { + public function matches($value) { return 'Test' === $value; } + })); } #[@test] public function is_not_a_test() { - $this->assertVerified(Assertions::of('Test')->isNot(newinstance(Condition::class, [], [ - 'matches' => function($value) { return 'Test' !== $value; } - ]))); + $this->assertVerified(Assertions::of('Test')->isNot(new class() extends Condition { + public function matches($value) { return 'Test' !== $value; } + })); } } \ No newline at end of file diff --git a/src/test/php/unittest/assert/unittest/ExtractingTest.class.php b/src/test/php/unittest/assert/unittest/ExtractingTest.class.php index 519efa6..f6e44e4 100755 --- a/src/test/php/unittest/assert/unittest/ExtractingTest.class.php +++ b/src/test/php/unittest/assert/unittest/ExtractingTest.class.php @@ -11,24 +11,24 @@ class ExtractingTest extends AbstractAssertionsTest { protected function people() { return [ [['id' => 1, 'name' => 'Test', 'age' => 42, 'department' => ['name' => 'Test']]], - [newinstance(Name::class, ['Test'], [ - 'id' => 1, - 'name' => 'Test', - 'age' => 42, - 'department' => ['name' => 'Test'] - ])], - [newinstance(Name::class, ['Test'], [ - 'id' => function() { return 1; }, - 'name' => function() { return 'Test'; }, - 'age' => function() { return 42; }, - 'department' => function() { return ['name' => 'Test']; } - ])], - [newinstance(Name::class, ['Test'], [ - 'getId' => function() { return 1; }, - 'getName' => function() { return 'Test'; }, - 'getAge' => function() { return 42; }, - 'getDepartment' => function() { return ['name' => 'Test']; } - ])], + [new class('Test') extends Name { + public $id= 1; + public $name= 'Test'; + public $age= 42; + public $department= ['name' => 'Test']; + }], + [new class('Test') extends Name { + public function id() { return 1; } + public function name() { return 'Test'; } + public function age() { return 42; } + public function department() { return ['name' => 'Test']; } + }], + [new class('Test') extends Name { + public function getId() { return 1; } + public function getName() { return 'Test'; } + public function getAge() { return 42; } + public function getDepartment() { return ['name' => 'Test']; } + }], [new Person(1, 'Test', 42, ['name' => 'Test'])] ]; }