$resp = $this->get('/books/my-first-book');
$resp->assertSee($book->name);
- $resp->assertSee($book->description);
+ $resp->assertSee($book->descriptionInfo()->getPlain());
}
public function test_create_uses_different_slugs_when_name_reused()
$this->assertEquals('list', setting()->getUser($editor, 'books_view_type'));
}
- public function test_slug_multi_byte_url_safe()
- {
- $book = $this->entities->newBook([
- 'name' => 'информация',
- ]);
-
- $this->assertEquals('informaciia', $book->slug);
-
- $book = $this->entities->newBook([
- 'name' => '¿Qué?',
- ]);
-
- $this->assertEquals('que', $book->slug);
- }
-
- public function test_slug_format()
- {
- $book = $this->entities->newBook([
- 'name' => 'PartA / PartB / PartC',
- ]);
-
- $this->assertEquals('parta-partb-partc', $book->slug);
- }
-
public function test_description_limited_to_specific_html()
{
$book = $this->entities->book();
- $input = '<h1>Test</h1><p id="abc" href="beans">Content<a href="#cat" data-a="b">a</a><section>Hello</section></p>';
- $expected = '<p>Content<a href="#cat">a</a></p>';
+ $input = '<h1>Test</h1><p id="abc" href="beans">Content<a href="#cat" target="_blank" data-a="b">a</a><section>Hello</section></p>';
+ $expected = '<p>Content<a href="#cat" target="_blank">a</a></p>';
$this->asEditor()->put($book->getUrl(), [
'name' => $book->name,
$coverImageFile = $this->files->uploadedImage('cover.png');
$bookRepo->updateCoverImage($book, $coverImageFile);
- $this->asEditor()->post($book->getUrl('/copy'), ['name' => 'My copy book']);
+ $this->asEditor()->post($book->getUrl('/copy'), ['name' => 'My copy book'])->assertRedirect();
/** @var Book $copy */
$copy = Book::query()->where('name', '=', 'My copy book')->first();
- $this->assertNotNull($copy->cover);
- $this->assertNotEquals($book->cover->id, $copy->cover->id);
+ $this->assertNotNull($copy->coverInfo()->getImage());
+ $this->assertNotEquals($book->coverInfo()->getImage()->id, $copy->coverInfo()->getImage()->id);
}
public function test_copy_adds_book_to_shelves_if_edit_permissions_allows()