Update tests

This commit is contained in:
philipp lang 2024-01-02 00:41:22 +01:00
parent cfb38ed792
commit 9c33c8f128
3 changed files with 2126 additions and 891 deletions

View File

@ -35,5 +35,12 @@
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
"providers": [
"Zoomyboy\\MedialibraryHelper\\ServiceProvider"
]
}
}
}

2966
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
<?php
namespace Zoomyboy\MedialibraryHelper\Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Zoomyboy\MedialibraryHelper\Tests\TestCase;
class MiddlewareTest extends TestCase
{
use RefreshDatabase;
public function testItReturns401WhenNotLoggedIn(): void
{
$this->registerModel();
$post = $this->newPost();
$response = $this->postJson('/mediaupload', [
'model' => 'post',
'id' => $post->id,
'collection' => 'defaultSingleFile',
'content' => base64_encode($this->pdfFile()->getContent()),
'name' => 'beispiel bild.jpg',
]);
$response->assertStatus(401);
}
public function testItReturns401WhenDestroying(): void
{
$this->registerModel();
$post = $this->newPost();
$media = $post->addMedia($this->pdfFile()->getPathname())->toMediaCollection('defaultSingleFile');
$response = $this->deleteJson("/mediaupload/{$media->id}");
$response->assertStatus(401);
}
protected function defineEnvironment($app)
{
$app['config']->set('media-library.middleware', ['web', 'auth:web']);
}
}