/** @test */ public function it_parses_result_by_blueprint() { $result = $this->resource->posts_page(); $this->assertEquals('Моя лента', $result['title']); $this->assertEquals('http://tmtm.ru/', $result['copyright']); $this->assertCount(10, $result['posts']); $this->assertEquals('Проверьте своего хостера на' . ' уязвимость Shellshock (часть 2)', $result['posts'][0]['title']); }
<?php include '../loader.php'; $api = new TestApi('sample_project'); $api->main();
/** @test */ public function it_parses_non_array_blueprint() { $result = $this->resource->non_array_blueprint(); $this->assertEquals('Моя лента', $result); }
<?php /** *这个类的用户是用来测试适配器 */ /** *导入适配器类 */ include './Adapter.class.php'; class TestApi { public function run() { $adapter = new Adapter(); $adapter->test(); echo "\r\n"; $adapter->doSomeThing('一句话'); echo "\r\n"; } } $testApi = new TestApi(); $testApi->run();