adminApiFile = new \Admin\Api\File(); } protected function tearDown() { // 输出本次单元测试所执行的SQL语句 // var_dump(\PhalApi\DI()->tracer->getSqls()); // 输出本次单元测试所涉及的追踪埋点 // var_dump(\PhalApi\DI()->tracer->getStack()); } /** * @group testGetRules */ public function testGetRules() { $rs = $this->adminApiFile->getRules(); } /** * @group testGetList */ public function testGetList() { // 提供一些数据 $domain = new \Base\Domain\File(); $domain->addUploadFile('x.jpg', 'jpg', 10, '/uploads/haha.png', 'http://localhost/uploads/haha.png'); $url = "service=Admin.File.GetList"; $rs = TestRunner::go($url); $this->assertNotEmpty($rs); $this->assertNotEmpty($rs['total']); $this->assertNotEmpty($rs['files']); } /** * @group testDelFile */ public function testDelFile() { // 提供一些数据 $domain = new \Base\Domain\File(); $id = $domain->addUploadFile('x.jpg', 'jpg', 10, '/uploads/haha.png', 'http://localhost/uploads/haha.png'); $url = "service=Admin.File.DelFile&id=$id"; $rs = TestRunner::go($url); $this->assertTrue(is_bool($rs)); $this->assertTrue($rs); } }