Beispiel #1
0
 function testRemove()
 {
     $class = $this->namespace . '\\Baz';
     $this->assertTrue($this->store->save($class, "namespace " . $this->namespace . ";\n" . "class Baz { public function action() { return 'baz'; } }"));
     $this->assertEquals(\Codify\StoreInterface::AUTOLOAD_SUCCESS, $this->store->autoload($class));
     $instance = new $class();
     $this->assertInstanceOf($class, $instance);
     $this->assertEquals('baz', $instance->action());
     $this->assertTrue($this->store->remove($class));
     $this->assertEquals(\Codify\StoreInterface::AUTOLOAD_CLASS_NOT_FOUND, $this->store->autoload($class));
 }
Beispiel #2
0
 function testUnregisterWorks()
 {
     $autoloader = new \Codify\Autoloader($this->store);
     $autoloader->register();
     $class_1 = $this->namespace . '\\Bar';
     $this->assertTrue($this->store->save($class_1, "namespace " . $this->namespace . ";\n" . "class Bar { public function action() { return 'bar'; } }"));
     $this->assertTrue(class_exists($class_1));
     $autoloader->unregister();
     $class_2 = $this->namespace . '\\Baz';
     $this->assertTrue($this->store->save($class_2, "namespace " . $this->namespace . ";\n" . "class Baz { public function action() { return 'baz'; } }"));
     $this->assertFalse(class_exists($class_2));
 }