File: NamespaceUnqualifiedTest.php

package info (click to toggle)
php-opis-closure 3.6.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 576 kB
  • sloc: php: 3,313; xml: 41; makefile: 17; sh: 8
file content (23 lines) | stat: -rw-r--r-- 499 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace Opis\Closure\Test;

use Closure;
use Opis\Closure\ReflectionClosure;

final class NamespaceUnqualifiedTest extends \PHPUnit\Framework\TestCase
{
    public function test_instantiate_non_qualified_class_name()
    {
        $f = function (){ new A\B; };
        $e = 'function (){ new \A\B; }';
        $this->assertEquals($e, $this->c($f));
    }

    protected function c(Closure $closure)
    {
        $r = new ReflectionClosure($closure);

        return $r->getCode();
    }
}