]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/EntityTest.php
Use joint_permissions to determine is a user has an available page or chapter to...
[bookstack] / tests / Entity / EntityTest.php
index 352af1e42a0efa93c97aa6ac3a70e83806881725..ef9597d328496aac1ba8ee292917003053e5b426 100644 (file)
@@ -1,10 +1,12 @@
 <?php namespace Tests;
 
 <?php namespace Tests;
 
-use BookStack\Book;
-use BookStack\Chapter;
-use BookStack\Page;
-use BookStack\Repos\EntityRepo;
-use BookStack\Repos\UserRepo;
+use BookStack\Entities\Book;
+use BookStack\Entities\Chapter;
+use BookStack\Entities\Page;
+use BookStack\Entities\Repos\EntityRepo;
+use BookStack\Auth\UserRepo;
+use BookStack\Entities\Repos\PageRepo;
+use Carbon\Carbon;
 
 class EntityTest extends BrowserKitTest
 {
 
 class EntityTest extends BrowserKitTest
 {
@@ -192,7 +194,7 @@ class EntityTest extends BrowserKitTest
         $entities = $this->createEntityChainBelongingToUser($creator, $updater);
         $this->actingAs($creator);
         app(UserRepo::class)->destroy($creator);
         $entities = $this->createEntityChainBelongingToUser($creator, $updater);
         $this->actingAs($creator);
         app(UserRepo::class)->destroy($creator);
-        app(EntityRepo::class)->savePageRevision($entities['page']);
+        app(PageRepo::class)->savePageRevision($entities['page']);
 
         $this->checkEntitiesViewable($entities);
     }
 
         $this->checkEntitiesViewable($entities);
     }
@@ -205,7 +207,7 @@ class EntityTest extends BrowserKitTest
         $entities = $this->createEntityChainBelongingToUser($creator, $updater);
         $this->actingAs($updater);
         app(UserRepo::class)->destroy($updater);
         $entities = $this->createEntityChainBelongingToUser($creator, $updater);
         $this->actingAs($updater);
         app(UserRepo::class)->destroy($updater);
-        app(EntityRepo::class)->savePageRevision($entities['page']);
+        app(PageRepo::class)->savePageRevision($entities['page']);
 
         $this->checkEntitiesViewable($entities);
     }
 
         $this->checkEntitiesViewable($entities);
     }
@@ -269,6 +271,9 @@ class EntityTest extends BrowserKitTest
     public function test_recently_updated_pages_on_home()
     {
         $page = Page::orderBy('updated_at', 'asc')->first();
     public function test_recently_updated_pages_on_home()
     {
         $page = Page::orderBy('updated_at', 'asc')->first();
+        Page::where('id', '!=', $page->id)->update([
+            'updated_at' => Carbon::now()->subSecond(1)
+        ]);
         $this->asAdmin()->visit('/')
             ->dontSeeInElement('#recently-updated-pages', $page->name);
         $this->visit($page->getUrl() . '/edit')
         $this->asAdmin()->visit('/')
             ->dontSeeInElement('#recently-updated-pages', $page->name);
         $this->visit($page->getUrl() . '/edit')