1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 07:32:39 +01:00

Applied styleci changes for conversion work

This commit is contained in:
Dan Brown 2022-06-19 18:14:53 +01:00
parent 85f59b5275
commit ba25dda031
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
12 changed files with 12 additions and 14 deletions

View File

@ -6,12 +6,10 @@ use BookStack\Actions\ActivityType;
use BookStack\Entities\Models\Book; use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf; use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Tools\TrashCan; use BookStack\Entities\Tools\TrashCan;
use BookStack\Exceptions\ImageUploadException;
use BookStack\Exceptions\NotFoundException; use BookStack\Exceptions\NotFoundException;
use BookStack\Facades\Activity; use BookStack\Facades\Activity;
use Exception; use Exception;
use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
class BookshelfRepo class BookshelfRepo

View File

@ -89,6 +89,7 @@ class Cloner
/** /**
* Convert an entity to a raw data array of input data. * Convert an entity to a raw data array of input data.
*
* @return array<string, mixed> * @return array<string, mixed>
*/ */
public function entityToInputData(Entity $entity): array public function entityToInputData(Entity $entity): array

View File

@ -45,6 +45,7 @@ class HierarchyTransformer
$this->trashCan->destroyEntity($chapter); $this->trashCan->destroyEntity($chapter);
Activity::add(ActivityType::BOOK_CREATE_FROM_CHAPTER, $book); Activity::add(ActivityType::BOOK_CREATE_FROM_CHAPTER, $book);
return $book; return $book;
} }
@ -80,6 +81,7 @@ class HierarchyTransformer
$shelf->books()->sync($shelfBookSyncData); $shelf->books()->sync($shelfBookSyncData);
Activity::add(ActivityType::BOOKSHELF_CREATE_FROM_BOOK, $shelf); Activity::add(ActivityType::BOOKSHELF_CREATE_FROM_BOOK, $shelf);
return $shelf; return $shelf;
} }
} }

View File

@ -89,7 +89,8 @@ class BookApiController extends ApiController
return response('', 204); return response('', 204);
} }
protected function rules(): array { protected function rules(): array
{
return [ return [
'create' => [ 'create' => [
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],

View File

@ -274,7 +274,6 @@ class ChapterController extends Controller
return redirect($chapter->getUrl()); return redirect($chapter->getUrl());
} }
/** /**
* Convert the chapter to a book. * Convert the chapter to a book.
*/ */

View File

@ -139,7 +139,7 @@ class BooksApiTest extends TestCase
// Ensure further updates without image do not clear cover image // Ensure further updates without image do not clear cover image
$resp = $this->put($this->baseEndpoint . "/{$book->id}", [ $resp = $this->put($this->baseEndpoint . "/{$book->id}", [
'name' => 'My updated book again' 'name' => 'My updated book again',
]); ]);
$book->refresh(); $book->refresh();

View File

@ -167,7 +167,7 @@ class ShelvesApiTest extends TestCase
// Ensure further updates without image do not clear cover image // Ensure further updates without image do not clear cover image
$resp = $this->put($this->baseEndpoint . "/{$shelf->id}", [ $resp = $this->put($this->baseEndpoint . "/{$shelf->id}", [
'name' => 'My updated shelf again' 'name' => 'My updated shelf again',
]); ]);
$shelf->refresh(); $shelf->refresh();

View File

@ -12,7 +12,6 @@ use Tests\TestCase;
class ConvertTest extends TestCase class ConvertTest extends TestCase
{ {
public function test_chapter_edit_view_shows_convert_option() public function test_chapter_edit_view_shows_convert_option()
{ {
/** @var Chapter $chapter */ /** @var Chapter $chapter */
@ -143,5 +142,4 @@ class ConvertTest extends TestCase
$this->assertNotPermissionError($resp); $this->assertNotPermissionError($resp);
$resp->assertRedirect(); $resp->assertRedirect();
} }
} }

View File

@ -8,7 +8,6 @@ use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page; use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\BaseRepo; use BookStack\Entities\Repos\BaseRepo;
use BookStack\Entities\Repos\BookRepo; use BookStack\Entities\Repos\BookRepo;
use BookStack\Entities\Repos\BookshelfRepo;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Tests\Uploads\UsesImages; use Tests\Uploads\UsesImages;