GetFromUrlParamTagTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Knuckles\Scribe\Tests\Strategies\UrlParameters;
  3. use Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromUrlParamTag;
  4. use Knuckles\Scribe\Tools\DocumentationConfig;
  5. use Mpociot\Reflection\DocBlock\Tag;
  6. use PHPUnit\Framework\TestCase;
  7. use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
  8. class GetFromUrlParamTagTest extends TestCase
  9. {
  10. use ArraySubsetAsserts;
  11. /** @test */
  12. public function can_fetch_from_urlparam_tag()
  13. {
  14. $strategy = new GetFromUrlParamTag(new DocumentationConfig([]));
  15. $tags = [
  16. new Tag('urlParam', 'id required The id of the order.'),
  17. new Tag('urlParam', 'lang The language to serve in.'),
  18. ];
  19. $results = $strategy->getUrlParametersFromDocBlock($tags);
  20. $this->assertArraySubset([
  21. 'id' => [
  22. 'required' => true,
  23. 'description' => 'The id of the order.',
  24. ],
  25. 'lang' => [
  26. 'required' => false,
  27. 'description' => 'The language to serve in.',
  28. ],
  29. ], $results);
  30. }
  31. }