1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Fixed issue with deleted users in page revision list & extended tests to cover.

This commit is contained in:
Dan Brown
2015-12-15 19:53:46 +00:00
parent af33156369
commit 497747e621
3 changed files with 25 additions and 7 deletions

View File

@ -173,26 +173,40 @@ class EntityTest extends TestCase
public function testEntitiesViewableAfterCreatorDeletion()
{
// Create required assets and revisions
$creator = $this->getNewUser();
$updater = $this->getNewUser();
$entities = $this->createEntityChainBelongingToUser($creator, $updater);
$this->actingAs($creator);
app('BookStack\Repos\UserRepo')->destroy($creator);
app('BookStack\Repos\PageRepo')->saveRevision($entities['page']);
$this->asAdmin()->visit($entities['book']->getUrl())->seeStatusCode(200)
->visit($entities['chapter']->getUrl())->seeStatusCode(200)
->visit($entities['page']->getUrl())->seeStatusCode(200);
$this->checkEntitiesViewable($entities);
}
public function testEntitiesViewableAfterUpdaterDeletion()
{
// Create required assets and revisions
$creator = $this->getNewUser();
$updater = $this->getNewUser();
$entities = $this->createEntityChainBelongingToUser($creator, $updater);
$this->actingAs($updater);
app('BookStack\Repos\UserRepo')->destroy($updater);
app('BookStack\Repos\PageRepo')->saveRevision($entities['page']);
$this->asAdmin()->visit($entities['book']->getUrl())->seeStatusCode(200)
$this->checkEntitiesViewable($entities);
}
private function checkEntitiesViewable($entities)
{
// Check pages and books are visible.
$this->asAdmin();
$this->visit($entities['book']->getUrl())->seeStatusCode(200)
->visit($entities['chapter']->getUrl())->seeStatusCode(200)
->visit($entities['page']->getUrl())->seeStatusCode(200);
// Check revision listing shows no errors.
$this->visit($entities['page']->getUrl())
->click('Revisions')->seeStatusCode(200);
}