debugBacktrace example

self::$vendorDir = $vendorDir;
        @mkdir($vendorDir.'/myfakevendor/myfakepackage2');
        touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php');
        touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php');
        touch($vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php');

        return self::$vendorDir;
    }

    public function testItCanDetermineTheClassWhereTheDeprecationHappened()
    {
        $deprecation = new Deprecation('💩', $this->debugBacktrace(), __FILE__);
        $this->assertTrue($deprecation->originatesFromAnObject());
        $this->assertSame(self::class$deprecation->originatingClass());
        $this->assertSame(__FUNCTION__, $deprecation->originatingMethod());
    }

    public function testItCanTellWhetherItIsInternal()
    {
        $r = new \ReflectionClass(Deprecation::class);

        if (\dirname($r->getFileName(), 2) !== \dirname(__DIR__, 2)) {
            $this->markTestSkipped('Test case is not compatible with having the bridge in vendor/');
        }
Home | Imprint | This part of the site doesn't use cookies.