* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class ApiManagerTest extends ApiManagerTestCase { public function testGetApiAnnotation() { $specification = $this->apiManager->getApi(TestController::class, '/foo'); $this->assertInstanceOf(SpecificationInterface::class, $specification); } public function testGetApiOpenAPI() { $specification = $this->apiManager->getApi(__DIR__ . '/Parser/openapi/test.json', '/foo/:fooId'); $this->assertInstanceOf(SpecificationInterface::class, $specification); } public function testGetApiFileDoesNotExist() { $this->expectException(\RuntimeException::class); $this->apiManager->getApi(__DIR__ . '/Parser/openapi/unknown.json', '/foo/:fooId'); } public function testGetApiInvalidType() { $this->expectException(\RuntimeException::class); $this->apiManager->getApi('', '/foo', 12); } public function testGetBuilder() { $builder = $this->apiManager->getBuilder(Resource::STATUS_ACTIVE, '/foo'); $builder->setTitle('My_Resource'); $builder->setDescription('My super resource'); $builder->setPathParameters('Path')->addInteger('todo_id'); $builder->setTags(['my_tag']); $post = $builder->addMethod('POST'); $post->setOperationId('my_action'); $post->setQueryParameters('PostQuery')->addInteger('startIndex'); $post->setDescription('My method description'); $post->setRequest(__DIR__ . '/Parser/schema/schema.json'); $post->addResponse(200, __DIR__ . '/Parser/schema/schema.json'); $post->setSecurity('OAuth2', ['foo']); $post->setTags(['my_tag']); $specification = $builder->getSpecification(); $this->assertInstanceOf(SpecificationInterface::class, $specification); } } __halt_compiler();----SIGNATURE:----BVxoXbNpZanaxNni3S6VWSD6Zmopf0h7zbXCGDT4yCXe5RBD+LPGqa3M/w1FJ15SA4sXwiJzIDNYEwCdCe9skOM1BK8LkgC7UAiRe86NoVNSVtOVeKfhV8q0w3c/Cbo5rRVZpzrASqrJzjqD4NJVjWRmjmnpIOiIEfZvRk8db1RPAUmfvpp2/k6fG1QegovRCXrVskxYzkvM20XZMyci2u6Mx9rPsGwPSSY7RtQcw/yqowfiJlxN7WiX7NWTUIaTheqA1lE5r+3nN16wQ1wkBwuroRMqhZkx2hIpksKTMwuk+SdgHX4fXLYggagjxfNy9NBmJhQ936ddxkmSCv+0q1p+g+NbzMhbYGzdwZEEowPWuVZJWHtLLVeZHPOgpKIOAhFTxFSIJyf0Xl3NUjcheucbR24WFa3o7KuNQpjC/ebONwXe9Hwv4KwgjldPdZ4uGaa23XCLMry9I+Q0StNDArrqlLtENVMMWJDrIvrju5eviZvBZ3Y02/mHDfa7bnjZ5wwV54TLeQXqpwlogyetUMiUKmXwZ47uN0ZyxLH6N8TMZOwqQtIuq3G4cxaP49erxMpcokViLOao9qDRzRy+60nqg7wHbKp1xeHTHnDbZtshLvJIOkNK4vy0uWUz0X+XJa1XpnkCdHGlexStQj7zmccim8V3dHs3ia8EHFFY6Jk=----ATTACHMENT:----Mjc0ODQ3MDA5MjU0MjE5MiA1MzQ3MzExOTk2ODE1Mzg3IDQ1Mzk1MDc0MzQwNzY4MDI=