Extracted entity testcase methods to own class

Also added some new fetch helper methods for future use.
This commit is contained in:
Dan Brown
2022-09-29 16:49:25 +01:00
parent 0e94fd44a8
commit 068a8a068c
23 changed files with 305 additions and 208 deletions

View File

@ -246,13 +246,13 @@ class BookTest extends TestCase
public function test_slug_multi_byte_url_safe()
{
$book = $this->newBook([
$book = $this->entities->newBook([
'name' => 'информация',
]);
$this->assertEquals('informaciya', $book->slug);
$book = $this->newBook([
$book = $this->entities->newBook([
'name' => '¿Qué?',
]);
@ -261,7 +261,7 @@ class BookTest extends TestCase
public function test_slug_format()
{
$book = $this->newBook([
$book = $this->entities->newBook([
'name' => 'PartA / PartB / PartC',
]);
@ -311,7 +311,7 @@ class BookTest extends TestCase
foreach ($book->getDirectChildren() as $child) {
$child->restricted = true;
$child->save();
$this->regenEntityPermissions($child);
$this->entities->regenPermissions($child);
}
$this->asEditor()->post($book->getUrl('/copy'), ['name' => 'My copy book']);
@ -365,7 +365,7 @@ class BookTest extends TestCase
$viewer = $this->getViewer();
$this->giveUserPermissions($viewer, ['book-update-all', 'book-create-all', 'bookshelf-update-all']);
$this->setEntityRestrictions($shelfB);
$this->entities->setPermissions($shelfB);
$this->asEditor()->post($book->getUrl('/copy'), ['name' => 'My copy book']);