]> BookStack Code Mirror - bookstack/blobdiff - tests/Actions/WebhookFormatTesting.php
My Acount: Updated old preference url reference for watches
[bookstack] / tests / Actions / WebhookFormatTesting.php
index 4e9ba5e477c69a75ce59f84ef65da66f29143339..b4fa49532c44f1c2f592588532b4fd645ce3cfb7 100644 (file)
@@ -2,12 +2,9 @@
 
 namespace Tests\Actions;
 
-use BookStack\Actions\ActivityType;
-use BookStack\Actions\Webhook;
-use BookStack\Actions\WebhookFormatter;
-use BookStack\Entities\Models\Book;
-use BookStack\Entities\Models\Chapter;
-use BookStack\Entities\Models\Page;
+use BookStack\Activity\ActivityType;
+use BookStack\Activity\Models\Webhook;
+use BookStack\Activity\Tools\WebhookFormatter;
 use Illuminate\Support\Arr;
 use Tests\TestCase;
 
@@ -16,9 +13,9 @@ class WebhookFormatTesting extends TestCase
     public function test_entity_events_show_related_user_info()
     {
         $events = [
-            ActivityType::BOOK_UPDATE    => Book::query()->first(),
-            ActivityType::CHAPTER_CREATE => Chapter::query()->first(),
-            ActivityType::PAGE_MOVE      => Page::query()->first(),
+            ActivityType::BOOK_UPDATE    => $this->entities->book(),
+            ActivityType::CHAPTER_CREATE => $this->entities->chapter(),
+            ActivityType::PAGE_MOVE      => $this->entities->page(),
         ];
 
         foreach ($events as $event => $entity) {
@@ -32,8 +29,7 @@ class WebhookFormatTesting extends TestCase
 
     public function test_page_create_and_update_events_show_revision_info()
     {
-        /** @var Page $page */
-        $page = Page::query()->first();
+        $page = $this->entities->page();
         $this->asEditor()->put($page->getUrl(), ['name' => 'Updated page', 'html' => 'new page html', 'summary' => 'Update a']);
 
         $data = $this->getWebhookData(ActivityType::PAGE_UPDATE, $page);
@@ -45,7 +41,7 @@ class WebhookFormatTesting extends TestCase
     protected function getWebhookData(string $event, $detail): array
     {
         $webhook = Webhook::factory()->make();
-        $user = $this->getEditor();
+        $user = $this->users->editor();
         $formatter = WebhookFormatter::getDefault($event, $webhook, $detail, $user, time());
 
         return $formatter->format();