Skip to content

Commit

Permalink
Expect warning instead of notice in PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
W0rma committed Oct 12, 2020
1 parent 6d23e17 commit 75d8c7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require-dev" : {
"doctrine/cache" : "^1.0",
"doctrine/coding-standard": "^8.0",
"phpunit/phpunit": "^8.0|^9.0",
"phpunit/phpunit": "^8.5|^9.0",
"psr/container": "^1.0",
"symfony/cache" : "^3.1|^4.0|^5.0",
"symfony/dependency-injection" : "^3.1|^4.0|^5.0"
Expand Down
8 changes: 6 additions & 2 deletions tests/MethodMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Metadata\MethodMetadata;
use Metadata\Tests\Fixtures\TestObject;
use PHPUnit\Framework\Error\Notice;
use PHPUnit\Framework\TestCase;

class MethodMetadataTest extends TestCase
Expand Down Expand Up @@ -85,7 +84,12 @@ public function testReadAccessForUnknownProperty()
{
$metadata = new MethodMetadata(TestObject::class, 'setFoo');

$this->expectException(Notice::class);
if (version_compare(PHP_VERSION, '8.0.0-dev', '>=')) {
$this->expectWarning();
} else {
$this->expectNotice();
}

$this->expectExceptionMessage('Undefined property: Metadata\MethodMetadata::$unknownProperty');

$metadata->unknownProperty;
Expand Down

0 comments on commit 75d8c7b

Please sign in to comment.