예제 #1
0
         $interceptor->getPrefixes();
         $interceptor->getPrefixesPsr4();
     });
 });
 describe("::unpatch()", function () {
     it("detaches the patched autoloader", function () {
         Interceptor::patch(['cachePath' => $this->cachePath]);
         $success = Interceptor::unpatch();
         $actual = Interceptor::instance();
         expect($success)->toBe(true);
         expect($actual)->toBe(null);
     });
     it("returns `false` if there's no patched autoloader", function () {
         Interceptor::patch(['cachePath' => $this->cachePath]);
         Interceptor::unpatch();
         $success = Interceptor::unpatch();
         expect($success)->toBe(false);
     });
 });
 describe("::load()", function () {
     it("auto unpatch when loading an interceptor autoloader", function () {
         $interceptor = Interceptor::patch(['cachePath' => $this->cachePath]);
         $new = new Interceptor(['originalLoader' => $interceptor->originalLoader(), 'cachePath' => $this->cachePath]);
         Interceptor::load($new);
         expect(Interceptor::instance())->toBe($new);
         expect(Interceptor::instance())->not->toBe($interceptor);
     });
 });
 describe("::instance()", function () {
     it("returns the interceptor autoloader", function () {
         $interceptor = Interceptor::patch(['cachePath' => $this->cachePath]);
예제 #2
0
 /**
  * Disables filter JIT patching.
  */
 public static function unpatch()
 {
     if (!static::$_interceptor) {
         return true;
     }
     $patchers = static::$_interceptor->patchers();
     $patchers->remove('filter');
     static::$_interceptor = null;
     if (static::$_unpatch) {
         static::$_unpatch = false;
         return Interceptor::unpatch();
     }
     return true;
 }