Skip to content

Commit 06d98c8

Browse files
committed
tests: added test for magic constants
1 parent 169f32d commit 06d98c8

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
use Tester\Assert;
4+
5+
require __DIR__ . '/../../vendor/autoload.php';
6+
7+
Tester\Environment::setup();
8+
9+
10+
DG\BypassFinals::enable();
11+
12+
require __DIR__ . '/fixtures/magic.constants.php';
13+
14+
15+
$rc = new ReflectionClass('Foo');
16+
Assert::false($rc->isFinal());
17+
18+
$res = getMagic();
19+
Assert::same(__DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'magic.constants.php', $res[0]);
20+
Assert::same(__DIR__ . DIRECTORY_SEPARATOR . 'fixtures', $res[1]);
21+
Assert::same(__DIR__ . DIRECTORY_SEPARATOR . 'fixtures', $res[2]);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
final class Foo // to not be skipped
4+
{
5+
}
6+
7+
8+
function getMagic()
9+
{
10+
return [__FILE__, __DIR__, eval('return __DIR__;')];
11+
}

0 commit comments

Comments
 (0)