public function testFoundWithUID() { Pickles\Object::$instances = []; $_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['SERVER_NAME'] = '127.0.0.1'; file_put_contents('/tmp/pickles.php', '<?php $config = [ "environments" => [ "local" => "127.0.0.1", "production" => "123.456.789.0", ], "datasources" => [], ]; '); Pickles\Config::getInstance('/tmp/pickles.php'); $response = json_encode(['meta' => ['status' => 405, 'message' => 'Method not allowed.']]); $this->expectOutputString($response); $_SERVER['REQUEST_METHOD'] = 'GET'; $_REQUEST['request'] = 'v1/router/1'; new Pickles\Router(); }
public function testProfiler() { file_put_contents('/tmp/pickles.php', '<?php $config = [ "environments" => [ "local" => "127.0.0.1", "production" => "123.456.789.0", ], "pickles" => [ "datasource" => "mysql", "profiler" => true, "foo" => "bar", ], "datasources" => [ "mysql" => [ "driver" => "pdo_mysql", ], ], ]; '); $config = Pickles\Config::getInstance('/tmp/pickles.php'); $object = new Pickles\Object(); }
public function testProfiler() { $this->expectOutputRegex('/"profiler":{/'); file_put_contents('/tmp/pickles.php', '<?php $config = [ "environments" => [ "local" => "127.0.0.1", "production" => "123.456.789.0", ], "pickles" => [ "namespace" => "", "datasource" => "mysql", "profiler" => true, ], "datasources" => [ "mysql" => [ "driver" => "pdo_mysql", ], ], ]; '); Pickles\Config::getInstance('/tmp/pickles.php'); $_SERVER['REQUEST_METHOD'] = 'PUT'; $_REQUEST['request'] = 'v1/resource/1'; new Pickles\Router(); }
public function testGetInstance() { $_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['HTTP_HOST'] = '123.456.789.0'; $config = Pickles\Config::getInstance('/tmp/pickles.php'); $this->assertInstanceOf('Pickles\\Config', $config); }