* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class ResourceTest extends TestCase { public function testResource() { $resource = new Resource(Resource::STATUS_ACTIVE, '/foo'); $resource->setTitle('foobar'); $resource->setDescription('foobar'); $resource->setPathParameters('Path'); $resource->addMethod(Resource\Factory::getMethod('GET')); $this->assertEquals(Resource::STATUS_ACTIVE, $resource->getStatus()); $this->assertTrue($resource->isActive()); $this->assertFalse($resource->isDeprecated()); $this->assertFalse($resource->isClosed()); $this->assertEquals('/foo', $resource->getPath()); $this->assertEquals('foobar', $resource->getTitle()); $this->assertEquals('foobar', $resource->getDescription()); $this->assertEquals('Path', $resource->getPathParameters()); $this->assertInstanceOf(Resource\MethodAbstract::class, $resource->getMethod('GET')); $this->assertEquals(['GET' => $resource->getMethod('GET')], $resource->getMethods()); $this->assertEquals(['GET'], $resource->getAllowedMethods()); $this->assertTrue($resource->hasMethod('GET')); $this->assertFalse($resource->hasMethod('POST')); $this->assertTrue($resource->hasPathParameters()); } public function testGetMethodInvalid() { $this->expectException(\RuntimeException::class); $resource = new Resource(Resource::STATUS_ACTIVE, '/foo'); $resource->getMethod('GET'); } } __halt_compiler();----SIGNATURE:----Wgh1KNC2S59MyVwMqUMGoBPIoFe5m3Bnuc48Fn17lMXgxI/qEyJqxmUtjffOA+51v0d+cbdYwrD3sP5VbBBA+rbuoeK4fnyojiUYs7D84to6BzTf35NPk2zIFEyhYrDGQQ5sL0XjOxG3VQ3cpqG+cugwgN6Ql3sdX9vh694VcOwWiv6phmx+cAotv5y4hkIejlvSIM3FWHeti5rJ69wnDxNhfx6mO2d8k0gRMBkoXp3ghl5HuSgujUfrrzF+KUsqemQHuwmXPbbfO+kBRB10gdfNkCkcrQKuWH+3k5jDtPE1StptPbcn4LG6X2Tt/hLlpk6mEYkxtJ4vapHvZZ4ef+7WBsmqNPRuiuNM/0q6Zgh25R+0wSaqdDJczZEuyTUOolnFn/A75YhN3iCqYvalkJFavifmO1ZAwT3WxfyijF2vnBjDA65+rPf8FSlL6CGv5Klp5ppJd7MQ4HuIX3nB2yo+snZQ8U4UcKRerVYodm3GEyO3AjXY4giqJssu9/g7aoGLzh2hDlUWMVGFKBxyXlOIoQ3v+LSWcwbJlJe6V5viZV8k8JbaaDSxdth0VMrnRwahWTDb312E5JnzpHr5578U2V3waUVS+Q7GQMaTfSlIZolzE9dPYL6cPq0zA6jk/oWSW1dHwnAKGZblt1HWCRM9yVjCSV4HBThRk5LwPGY=----ATTACHMENT:----MzQ3NjE3MjA5MTg2MDY1OCAyMzcyMTEzNjI2NDcwNDI1IDMxNzA2NzU5MDkxNTE5NTY=