/** * @test * @profile */ public function testDispatch() { split_time('reset'); Rest_Test_Unit_Case_Resource_Foo::serve('resource/foo'); split_time('Invoke Rest_Test_Unit_Case_Resource_Foo::serve(resource/foo)'); Http_Scriptlet_Context::push(new Http_Scriptlet_Context(Environment::uriComponents())); split_time('Initialize Components\\Http_Scriptlet_Context'); $uri = Uri::valueOf(Environment::uriComponents('rest', 'resource', 'foo', 'poke', '1234.json')); split_time("Invoke Uri::valueOf({$uri})"); ob_start(); split_time('reset'); Http_Scriptlet_Context::current()->dispatch($uri, Http_Scriptlet_Request::METHOD_GET); split_time("Invoke Components\\Http_Scriptlet_Context\$dispatch([{$uri}], GET)"); $result = ob_get_clean(); assertEquals(json_encode(true), $result); split_time('reset'); $uri = Uri::valueOf(Environment::uriComponents('rest', 'resource', 'foo', 'poke', '1234.json')); $uri->setQueryParam('log', 'false'); split_time("Invoke Uri::valueOf({$uri})"); ob_start(); split_time('reset'); Http_Scriptlet_Context::current()->dispatch($uri, Http_Scriptlet_Request::METHOD_GET); split_time("Invoke Components\\Http_Scriptlet_Context\$dispatch([{$uri}], GET)"); $result = ob_get_clean(); assertEquals(json_encode(false), $result); }
/** * @test * @profile fork */ public function testParse() { split_time('Reset'); $annotations = Annotations::get('Components\\Type_Test_Unit_Case_Annotations_Entity'); split_time('Invoke Annotations::get(Components\\Type_Test_Unit_Case_Annotations_Entity)'); $annotations = Annotations::get('Components\\Type_Test_Unit_Case_Annotations_Entity'); split_time('Invoke Annotations::get(Components\\Type_Test_Unit_Case_Annotations_Entity)'); assertTrue($annotations->hasTypeAnnotation(Annotation_Name::NAME)); split_time('Invoke Annotations$hasMethodAnnotation(name)'); assertTrue($annotations->hasTypeAnnotation(Annotation_Name::NAME)); split_time('Invoke Annotations$hasMethodAnnotation(name)'); assertTrue($annotations->hasTypeAnnotation('package')); split_time('Invoke Annotations$hasMethodAnnotation(package)'); assertFalse($annotations->hasTypeAnnotation('version')); split_time('Invoke Annotations$hasMethodAnnotation(version)'); assertTrue($annotations->hasMethodAnnotation('poke', Annotation_Name::NAME)); split_time('Invoke Annotations$hasMethodAnnotation(poke)'); assertTrue($annotations->hasMethodAnnotation('poke', Annotation_Name::NAME)); split_time('Invoke Annotations$hasMethodAnnotation(poke)'); $pokeName = $annotations->getMethodAnnotation('poke', Annotation_Name::NAME); split_time('Invoke Annotations$getMethodAnnotation(poke)'); $pokeName = $annotations->getMethodAnnotation('poke', Annotation_Name::NAME); split_time('Invoke Annotations$getMethodAnnotation(poke)'); $annotations = Annotations::get(__CLASS__); split_time('Invoke Annotations::get(' . __CLASS__ . ')'); $annotations = Annotations::get(__CLASS__); split_time('Invoke Annotations::get(' . __CLASS__ . ')'); assertEquals('poke', $pokeName->value); }
/** * @test(expectedFail=true) * @profile(fork) */ public function testAssertSameFailed() { split_time('a'); $a = new \stdClass(); split_time('b'); $b = new \stdClass(); echo 'Here could be a reason or a hint on how to activate the skipped test. Here could be a reason or a hint on how to activate the skipped test. Here could be a reason or a hint on how to activate the skipped test. Here could be a reason or a hint on how to activate the skipped test. Here could be a reason or a hint on how to activate the skipped test. Here could be a reason or a hint on how to activate the skipped test.'; split_time('before same'); assertSame($a, $b); split_time('after same'); }