mirror of
https://github.com/ambieco/scribe.git
synced 2026-04-24 09:14:57 +08:00
Added markdown generation test
This commit is contained in:
61
tests/Fixtures/index.md
Normal file
61
tests/Fixtures/index.md
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
title: API Reference
|
||||
|
||||
language_tabs:
|
||||
- bash
|
||||
- javascript
|
||||
|
||||
includes:
|
||||
|
||||
search: true
|
||||
|
||||
toc_footers:
|
||||
- <a href='http://github.com/mpociot/documentarian'>Documentation Powered by Documentarian</a>
|
||||
---
|
||||
|
||||
# Info
|
||||
|
||||
Welcome to the generated API reference.
|
||||
|
||||
# Available routes
|
||||
#general
|
||||
## Example title.
|
||||
|
||||
This will be the long description.
|
||||
It can also be multiple lines long.
|
||||
|
||||
> Example request:
|
||||
|
||||
```bash
|
||||
curl "http://localhost/api/test" \
|
||||
-H "Accept: application/json"
|
||||
```
|
||||
|
||||
```javascript
|
||||
var settings = {
|
||||
"async": true,
|
||||
"crossDomain": true,
|
||||
"url": "http://localhost/api/test",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"accept": "application/json"
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax(settings).done(function (response) {
|
||||
console.log(response);
|
||||
});
|
||||
```
|
||||
|
||||
> Example response:
|
||||
|
||||
```json
|
||||
null
|
||||
```
|
||||
|
||||
### HTTP Request
|
||||
`GET api/test`
|
||||
|
||||
`HEAD api/test`
|
||||
|
||||
|
||||
@@ -57,6 +57,19 @@ class GenerateDocumentationTest extends TestCase
|
||||
$this->assertContains('Processed route: api/test', $output);
|
||||
}
|
||||
|
||||
public function testGeneratedMarkdownFileIsCorrect()
|
||||
{
|
||||
RouteFacade::get('/api/test', TestController::class.'@parseMethodDescription');
|
||||
|
||||
$output = $this->artisan('api:generate', [
|
||||
'--routePrefix' => 'api/*',
|
||||
]);
|
||||
|
||||
$generatedMarkdown = file_get_contents(__DIR__ . '/../public/docs/source/index.md');
|
||||
$fixtureMarkdown = file_get_contents(__DIR__ . '/Fixtures/index.md');
|
||||
$this->assertSame($generatedMarkdown, $fixtureMarkdown);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $command
|
||||
* @param array $parameters
|
||||
|
||||
Reference in New Issue
Block a user