'//localhost/assets/', 'img_cache_path' => _dir(self::ROOT_DIR, 'public/images'), 'data_cache_path' => _dir(self::TEST_DATA_DIR, 'cache'), 'database' => [ 'collection' => [ 'type' => 'sqlite', 'host' => '', 'user' => '', 'pass' => '', 'port' => '', 'name' => 'default', 'database' => '', 'file' => ':memory:', ] ], 'routes' => [ 'route_config' => [ 'asset_path' => '/assets' ], 'routes' => [ ] ] ]; // Set up DI container $di = require _dir($APP_DIR, 'bootstrap.php'); $container = $di($config_array); $container->set('error-handler', new MockErrorHandler()); $container->set('session-handler', self::$session_handler); $this->container = $container; } /** * Set arbitrary superglobal values for testing purposes * * @param array $supers * @return void */ public function setSuperGlobals($supers = []) { $default = [ '_GET' => $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE, '_SERVER' => $_SERVER, '_FILES' => $_FILES ]; $web_factory = new WebFactory(array_merge($default,$supers)); $this->container->set('request', $web_factory->newRequest()); $this->container->set('response', $web_factory->newResponse()); } /** * Create a mock guzzle client for testing * api call methods * * @param int $code The status code * @param array $headers * @param string $body * @return Client */ public function getMockClient($code, $headers, $body) { $mock = new MockHandler([ new Response($code, $headers, $body) ]); $handler = HandlerStack::create($mock); $client = new Client(['handler' => $handler]); return $client; } } // End of AnimeClient_TestCase.php