validate(); $this->assertEquals([], $server->getErrors()); $this->assertTrue($result); $this->assertEquals('https://{username}.gigantic-server.com:{port}/{basePath}', $server->url); $this->assertEquals('The production API server', $server->description); $this->assertCount(3, $server->variables); $this->assertEquals('demo', $server->variables['username']->default); $this->assertEquals('this value is assigned by the service provider, in this example `gigantic-server.com`', $server->variables['username']->description); $this->assertEquals('8443', $server->variables['port']->default); /** @var $server Server */ $server = Reader::readFromJson(<<validate(); $this->assertEquals(['Server is missing required property: url'], $server->getErrors()); $this->assertFalse($result); /** @var $server Server */ $server = Reader::readFromJson(<<validate(); $this->assertEquals(['ServerVariable is missing required property: default'], $server->getErrors()); $this->assertFalse($result); } }