Example #1
0
 public function testNavigatingARaml()
 {
     /* Given... (Fixture) */
     $jsonCoder = Stub::makeEmpty('GoIntegro\\Json\\JsonCoder');
     $ramlDoc = Stub::makeEmpty('GoIntegro\\Raml\\RamlDoc', ['rawRaml' => Yaml::parse(__DIR__ . self::DEFAULT_SCHEMA_RAML), 'schemas' => Stub::makeEmpty('GoIntegro\\Raml\\Root\\MapCollection')]);
     $navigator = new DocNavigator($ramlDoc, $jsonCoder);
     /* When... (Action) */
     $filteredResponses = $navigator->navigate('/some-resources', RamlSpec::HTTP_GET, 'responses');
     $withParamResponses = $navigator->navigate('/some-resources/{some-resource-ids}', RamlSpec::HTTP_PUT);
     $byIdsResponses = $navigator->navigate('/some-resources/1,2,3', RamlSpec::HTTP_PUT);
     /* Then... (Assertions) */
     $this->assertEquals([200 => NULL], $filteredResponses);
     $this->assertEquals(['description' => "Updates one or more resources.", 'responses' => [200 => NULL, 404 => NULL]], $byIdsResponses);
     $this->assertEquals(['description' => "Updates one or more resources.", 'responses' => [200 => NULL, 404 => NULL]], $withParamResponses);
 }