LibraryTipitakaReadTest.php 930 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. use Illuminate\Foundation\Testing\RefreshDatabase;
  3. use Illuminate\Support\Str;
  4. uses(RefreshDatabase::class);
  5. /**
  6. * 阅读页 /library/tipitaka/{book}-{para}/read 的目标不存在时返回 404,而不是 500。
  7. */
  8. it('returns 404 when the channel does not exist', function () {
  9. $this->get('/library/tipitaka/165-123/read?channel='.Str::uuid())
  10. ->assertNotFound();
  11. });
  12. it('returns 404 when the channel is not a uuid', function () {
  13. $this->get('/library/tipitaka/165-123/read?channel=not-a-uuid')
  14. ->assertNotFound();
  15. });
  16. it('returns 404 when the id is malformed', function () {
  17. $this->get('/library/tipitaka/abc/read?channel='.makeChannel(makeStudio('me'), 'c'))
  18. ->assertNotFound();
  19. });
  20. it('returns 404 when the paragraph is not a chapter', function () {
  21. $this->get('/library/tipitaka/99999-1/read?channel='.makeChannel(makeStudio('me'), 'c'))
  22. ->assertNotFound();
  23. });