Skip to content
Browse files

Fixed Twig Filter

Added two small unit tests
  • Loading branch information...
1 parent 4d7f9bf commit 79ebe98071b9c0a7e7661626fb3441bb310fd4ce @baldurrensch baldurrensch committed
Showing with 35 additions and 1 deletion.
  1. +1 −1 Resources/views/method.html.twig
  2. +34 −0 Tests/Annotation/ApiDocTest.php
View
2 Resources/views/method.html.twig
@@ -29,7 +29,7 @@
<h4>Documentation</h4>
<div>{{ data.documentation|extra_markdown }}</div>
{% if data.fileToInclude is defined and data.fileToInclude is not empty %}
- <div>{{ data.fileToInclude|markdown }}</div>
+ <div>{{ data.fileToInclude|extra_markdown }}</div>
{% endif %}
{% endif %}
View
34 Tests/Annotation/ApiDocTest.php
@@ -173,4 +173,38 @@ public function testConstructNoFiltersIfFormTypeDefined()
$this->assertEquals($data['description'], $array['description']);
$this->assertEquals($data['input'], $annot->getInput());
}
+
+ public function testConstructWithHTTPResponseCodes()
+ {
+ $data = array(
+ 'description' => 'Heya',
+ 'responseCodes' => array(
+ 200 => "Returned when successful",
+ 403 => "Returned when the user is not authorized"
+ )
+ );
+
+ $annot = new ApiDoc($data);
+ $array = $annot->toArray();
+
+ $this->assertTrue(is_array($array));
+ $this->assertTrue(is_array($array['responseCodes']));
+ foreach ($data['responseCodes'] as $code => $message) {
+ $this->assertEquals($array['responseCodes'][$code], $message);
+ }
+ }
+
+ public function testConstructWithFileToInclude()
+ {
+ $data = array(
+ 'description' => 'Heya',
+ 'include' => 'file/here/'
+ );
+
+ $annot = new ApiDoc($data);
+ $array = $annot->toArray();
+
+ $this->assertTrue(is_array($array));
+ $this->assertEquals($data['include'], $array['fileToInclude']);
+ }
}

0 comments on commit 79ebe98

Please sign in to comment.
Something went wrong with that request. Please try again.