X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a488ef6b00a51b8c052273c8ce0b3c0fda56b1fe..refs/pull/494/head:/tests/Entity/EntityTest.php diff --git a/tests/Entity/EntityTest.php b/tests/Entity/EntityTest.php index b818fcc38..ccc02c4f0 100644 --- a/tests/Entity/EntityTest.php +++ b/tests/Entity/EntityTest.php @@ -137,8 +137,6 @@ class EntityTest extends BrowserKitTest $book = factory(Book::class)->make([ 'name' => 'My First Book' ]); - - $this->uploadImage('test-image.jpg', 0); $this->asAdmin() ->visit('/books') // Choose to create a book @@ -147,27 +145,16 @@ class EntityTest extends BrowserKitTest // Fill out form & save ->type($book->name, '#name') ->type($book->description, '#description') - ->press('Select Image') - ->click('test-image.jpg') - ->press('Select Image') ->press('Save Book') // Check it redirects correctly ->seePageIs('/books/my-first-book') ->see($book->name)->see($book->description); - $book = factory(Book::class)->latest(); - $this->assertDatabaseHas('images', [ - 'id' => $book->image - ]); - // Ensure duplicate names are given different slugs $this->asAdmin() ->visit('/books/create') ->type($book->name, '#name') ->type($book->description, '#description') - ->press('Select Image') - ->click('test-image.jpg') - ->press('Select Image') ->press('Save Book'); $expectedPattern = '/\/books\/my-first-book-[0-9a-zA-Z]{3}/'; @@ -269,28 +256,4 @@ class EntityTest extends BrowserKitTest ->visit('/') ->seeInElement('#recently-updated-pages', $page->name); } - - public function test_recently_created_pages_on_home() - { - $entityChain = $this->createEntityChainBelongingToUser($this->getEditor()); - $this->asAdmin()->visit('/') - ->seeInElement('#recently-created-pages', $entityChain['page']->name); - } - - protected function uploadImage($name, $uploadedTo = 0) - { - $file = $this->getTestImage($name); - $this->call('POST', '/images/gallery/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []); - return $this->getTestImagePath('gallery', $name); - } - - protected function getTestImage($fileName) - { - return new \Illuminate\Http\UploadedFile(base_path('tests/test-data/test-image.jpg'), $fileName, 'image/jpeg', 5238); - } - - protected function getTestImagePath($type, $fileName) - { - return '/uploads/images/' . $type . '/' . Date('Y-m-M') . '/' . $fileName; - } }