N98\Util\AutoloadHandlerTest::cleanupCallback PHP Method

cleanupCallback() public method

public cleanupCallback ( )
    public function cleanupCallback()
    {
        $calls = (object) array('retval' => true);
        $assertAble = function ($className) use(&$calls) {
            $calls->log[] = array($className);
            $calls->count[$className] = 1 + @$calls->count[$className];
            return $calls->retval;
        };
        $handler = $this->create($assertAble, AutoloadHandler::NO_EXCEPTION);
        $cleanup = $handler->getCleanupCallback();
        $actual = class_exists('Test');
        $this->assertFalse($actual);
        $this->assertTrue(in_array($handler, spl_autoload_functions()), 'before cleanup');
        $cleanup();
        $this->assertFalse(in_array($handler, spl_autoload_functions()), 'after cleanup');
        // calling cleanup again must not do any warnings etc.
        $cleanup();
    }