* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class AsyncAPITest extends TestCase { public function testModel() { $asyncAPI = new AsyncAPI(); $info = new Info(); $info->setTitle('Account Service'); $info->setVersion('1.0.0'); $info->setDescription('This service is in charge of processing user signups :rocket:'); $asyncAPI->setInfo($info); $message = new Message(); $message->setPayload(Record::fromArray(['$ref' => '#/components/schemas/Pet'])); $http = new HttpOperationBinding(); $http->setType('request'); $http->setMethod('POST'); $bindings = new OperationBindings(); $bindings->setHttp($http); $operation = new Operation(); $operation->setMessage($message); $operation->setBindings($bindings); $channel = new Channel(); $channel->setPublish($operation); $channels = new Channels(); $channels['user/signedup'] = $channel; $asyncAPI->setChannels($channels); // schema $schemas = new Schemas(); $schemas['Pet'] = [ 'required' => ['id', 'name'], 'properties' => [ 'id' => ['type' => 'integer', 'format' => 'int64'], 'name' => ['type' => 'string'], 'tag' => ['type' => 'string'], ] ]; $components = new Components(); $components->setSchemas($schemas); $asyncAPI->setComponents($components); $dumper = new Dumper(); $actual = json_encode($dumper->dump($asyncAPI), JSON_PRETTY_PRINT); $expect = file_get_contents(__DIR__ . '/resources/asyncapi.json'); $this->assertJsonStringEqualsJsonString($expect, $actual, $actual); } } __halt_compiler();----SIGNATURE:----CU2j1zcZRrcXR5hdWPaLmvd5AUhfOPa04AUzvPqhB7cBcQRnb9yPm4nnRO1gFQ5xT+KP3oyasKvFbnd9Ql1PJPNoyyb2B19jSjcYFc/TXEpCT2N1e/Cr3bhPvxOra+lfiqrxFggW/x11q71MxXkxAuz3yic4yIwgkNl/4GO/Bgk2YStG9usRjerzPP7jb1Ctn6C4YlIS0DJr06bnOC69kA8+/iy9A/1kSK4zMAbynB2FBVCZHybiwTL1j0cr7Vuf35/5pK3PJI5VhhaJyupAhk0G7HirVqgqV21Myg7OHgyBMs8+CaoL70aIbwUazdCtxL3C51InZtVwzsHV0msm9lULducmQIrs7NtnItkZcPXHGIJq4WtcIBBafPIRi5xuqzYRy5GlLKWFJMBJNjGZcIwIyNy1kLROETuPqeqzPJCCZV5wlCdH2B5Jf3FZEwY24FyZkAzyuB499DUkYkG0e3dmEVmPqTcSLHokBtdOUnLhg4V7z2MwQ+YC4xXCJrlo4IEXcS51ErbHKk/WXG0WLEZ4YCrkIGYP2NJLhmnO9VRKNO+If+9QcJOzSV8gN6hevBflWTOydITrYQaoRSX+JfMsnDkKPguwbh9i+gJhFmP//SxDJg7IgJA3XVDl/QibGIVzWOiSqtUFuHcKZXL6aIrkpI+O3BpEFToj0oZce5g=----ATTACHMENT:----NjY3ODA3NTk2NTY1MTQ5IDQ3OTA4ODIxMjA0Mzk0OTIgMzgxOTEzNDE1OTA2Mjc1MQ==