Updated testcases for new search system.
Finishes implementation of new search system. Closes #271 Closes #344 Fixes #285 Fixes #269 Closes #64
Showing
3 changed files
with
17 additions
and
2 deletions
| ... | @@ -219,6 +219,7 @@ class EntityRepo | ... | @@ -219,6 +219,7 @@ class EntityRepo |
| 219 | * @param int $count | 219 | * @param int $count |
| 220 | * @param int $page | 220 | * @param int $page |
| 221 | * @param bool|callable $additionalQuery | 221 | * @param bool|callable $additionalQuery |
| 222 | + * @return Collection | ||
| 222 | */ | 223 | */ |
| 223 | public function getRecentlyCreated($type, $count = 20, $page = 0, $additionalQuery = false) | 224 | public function getRecentlyCreated($type, $count = 20, $page = 0, $additionalQuery = false) |
| 224 | { | 225 | { |
| ... | @@ -237,6 +238,7 @@ class EntityRepo | ... | @@ -237,6 +238,7 @@ class EntityRepo |
| 237 | * @param int $count | 238 | * @param int $count |
| 238 | * @param int $page | 239 | * @param int $page |
| 239 | * @param bool|callable $additionalQuery | 240 | * @param bool|callable $additionalQuery |
| 241 | + * @return Collection | ||
| 240 | */ | 242 | */ |
| 241 | public function getRecentlyUpdated($type, $count = 20, $page = 0, $additionalQuery = false) | 243 | public function getRecentlyUpdated($type, $count = 20, $page = 0, $additionalQuery = false) |
| 242 | { | 244 | { |
| ... | @@ -330,7 +332,7 @@ class EntityRepo | ... | @@ -330,7 +332,7 @@ class EntityRepo |
| 330 | if ($rawEntity->entity_type === 'BookStack\\Page') { | 332 | if ($rawEntity->entity_type === 'BookStack\\Page') { |
| 331 | $entities[$index] = $this->page->newFromBuilder($rawEntity); | 333 | $entities[$index] = $this->page->newFromBuilder($rawEntity); |
| 332 | if ($renderPages) { | 334 | if ($renderPages) { |
| 333 | - $entities[$index]->html = $rawEntity->description; | 335 | + $entities[$index]->html = $rawEntity->html; |
| 334 | $entities[$index]->html = $this->renderPage($entities[$index]); | 336 | $entities[$index]->html = $this->renderPage($entities[$index]); |
| 335 | }; | 337 | }; |
| 336 | } else if ($rawEntity->entity_type === 'BookStack\\Chapter') { | 338 | } else if ($rawEntity->entity_type === 'BookStack\\Chapter') { |
| ... | @@ -357,6 +359,7 @@ class EntityRepo | ... | @@ -357,6 +359,7 @@ class EntityRepo |
| 357 | * Get the child items for a chapter sorted by priority but | 359 | * Get the child items for a chapter sorted by priority but |
| 358 | * with draft items floated to the top. | 360 | * with draft items floated to the top. |
| 359 | * @param Chapter $chapter | 361 | * @param Chapter $chapter |
| 362 | + * @return \Illuminate\Database\Eloquent\Collection|static[] | ||
| 360 | */ | 363 | */ |
| 361 | public function getChapterChildren(Chapter $chapter) | 364 | public function getChapterChildren(Chapter $chapter) |
| 362 | { | 365 | { |
| ... | @@ -470,7 +473,7 @@ class EntityRepo | ... | @@ -470,7 +473,7 @@ class EntityRepo |
| 470 | 473 | ||
| 471 | /** | 474 | /** |
| 472 | * Update entity details from request input. | 475 | * Update entity details from request input. |
| 473 | - * Use for books and chapters | 476 | + * Used for books and chapters |
| 474 | * @param string $type | 477 | * @param string $type |
| 475 | * @param Entity $entityModel | 478 | * @param Entity $entityModel |
| 476 | * @param array $input | 479 | * @param array $input | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -76,4 +76,16 @@ abstract class TestCase extends BaseTestCase | ... | @@ -76,4 +76,16 @@ abstract class TestCase extends BaseTestCase |
| 76 | public function newChapter($input = ['name' => 'test chapter', 'description' => 'My new test chapter'], Book $book) { | 76 | public function newChapter($input = ['name' => 'test chapter', 'description' => 'My new test chapter'], Book $book) { |
| 77 | return $this->app[EntityRepo::class]->createFromInput('chapter', $input, $book); | 77 | return $this->app[EntityRepo::class]->createFromInput('chapter', $input, $book); |
| 78 | } | 78 | } |
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * Create and return a new test page | ||
| 82 | + * @param array $input | ||
| 83 | + * @return Chapter | ||
| 84 | + */ | ||
| 85 | + public function newPage($input = ['name' => 'test page', 'html' => 'My new test page']) { | ||
| 86 | + $book = Book::first(); | ||
| 87 | + $entityRepo = $this->app[EntityRepo::class]; | ||
| 88 | + $draftPage = $entityRepo->getDraftPage($book); | ||
| 89 | + return $entityRepo->publishPageDraft($draftPage, $input); | ||
| 90 | + } | ||
| 79 | } | 91 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment