コード例 #1
0
 function test_filebased_logger_writes_to_file_when_logging()
 {
     $GLOBALS['log'] = "";
     $debugger = new k_logging_LogDebugger('var://log');
     $glob = new k_adapter_MockGlobalsAccess(array(), array(), array('SERVER_NAME' => 'localhost'));
     $http = new k_HttpRequest('/web2.0', '/web2.0/foo/bar/cux', new k_DefaultIdentityLoader(), null, null, $glob);
     $components = new k_DefaultComponentCreator();
     $components->setDebugger($debugger);
     $root = $components->create('test_CircularComponent', $http);
     $result = $root->dispatch();
     $this->assertPattern('/\\(dispatch/', $GLOBALS['log']);
 }
コード例 #2
0
ファイル: k.test.php プロジェクト: RussellDias/konstrukt
 function createComponent($method, $headers = array())
 {
     $glob = new k_adapter_MockGlobalsAccess(array(), array(), array('SERVER_NAME' => 'localhost', 'REQUEST_METHOD' => $method), $headers);
     $translator_loader = new test_TranslatorLoader();
     $http = new k_HttpRequest('', '/', new k_DefaultIdentityLoader(), null, $translator_loader, $glob);
     $components = new k_DefaultComponentCreator();
     return $components->create('test_ContentTypeComponent', $http);
 }
コード例 #3
0
ファイル: url.test.php プロジェクト: RussellDias/konstrukt
 function test_subview_cares_about_underscores()
 {
     $http = $this->createHttp('/web2.0', '/foo/bar?delete');
     $components = new k_DefaultComponentCreator();
     $root = $components->create('test_CircularComponent', $http);
     $this->assertEqual('delete', $root->subview());
     $http = $this->createHttp('/web2.0', '/foo/bar?delete_something');
     $components = new k_DefaultComponentCreator();
     $root = $components->create('test_CircularComponent', $http);
     $this->assertEqual('delete_something', $root->subview());
 }
コード例 #4
0
ファイル: phemto.test.php プロジェクト: RussellDias/konstrukt
 function test_can_create_simple_component_with_default_container()
 {
     $components = new k_DefaultComponentCreator();
     $root = $components->create('test_BasicComponent', $this->makeHttp());
     $this->assertIsA($root, 'test_BasicComponent');
 }
コード例 #5
0
 function test_wrapped_response_retains_status()
 {
     $glob = new k_adapter_MockGlobalsAccess(array(), array(), array('SERVER_NAME' => 'localhost', 'REQUEST_METHOD' => 'get'));
     $http = new k_HttpRequest('', '/hello', new k_DefaultIdentityLoader(), null, null, $glob);
     $components = new k_DefaultComponentCreator();
     $root = $components->create('test_response_RootThreeComponent', $http);
     $r = $root->dispatch();
     $this->assertEqual($r->status(), 500);
     $this->assertEqual($r->toContentType($r->contentType()), "<div class='wrap'><p>Hello world</p></div>");
 }