|
|
|
@@ -7,6 +7,8 @@ |
|
|
|
|
|
|
|
namespace App\Tests\Functional; |
|
|
|
|
|
|
|
use App\Factory\MediaObjectLogoFactory; |
|
|
|
use App\Factory\PartnerFactory; |
|
|
|
use App\Factory\UserFactory; |
|
|
|
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; |
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; |
|
|
|
@@ -62,5 +64,51 @@ class MediaObjectResourceTest extends KernelTestCase |
|
|
|
]) |
|
|
|
->assertSuccessful() |
|
|
|
; |
|
|
|
|
|
|
|
$partner = PartnerFactory::createOne(); |
|
|
|
$this->browser() |
|
|
|
->patch('/api/partner/' . $partner->getId(), [ |
|
|
|
'headers' => [ |
|
|
|
'Authorization' => 'Bearer ' . $token, |
|
|
|
], |
|
|
|
'json' => [ |
|
|
|
'logo' => '/api/medias/1' |
|
|
|
] |
|
|
|
]) |
|
|
|
->assertSuccessful() |
|
|
|
; |
|
|
|
|
|
|
|
$this->browser() |
|
|
|
->delete('/api/medias/1', [ |
|
|
|
'headers' => [ |
|
|
|
'Authorization' => 'Bearer ' . $token, |
|
|
|
'Content-Type' => 'multipart/form-data' |
|
|
|
], |
|
|
|
]) |
|
|
|
->assertSuccessful() |
|
|
|
; |
|
|
|
} |
|
|
|
|
|
|
|
public function testDeleteMediaObject() |
|
|
|
{ |
|
|
|
$mediaObject = MediaObjectLogoFactory::createOne(); |
|
|
|
$user = UserFactory::createOne( |
|
|
|
[ |
|
|
|
'firstName' => 'Peter', |
|
|
|
'lastName' => 'Test', |
|
|
|
'password' => 'test', |
|
|
|
'email' => 'peter@test.de', |
|
|
|
] |
|
|
|
); |
|
|
|
$token = $this->JWTManager->create($user->object()); |
|
|
|
$this->browser() |
|
|
|
->delete('/api/medias/' . $mediaObject->getId(), [ |
|
|
|
'headers' => [ |
|
|
|
'Authorization' => 'Bearer ' . $token, |
|
|
|
'Content-Type' => 'multipart/form-data' |
|
|
|
], |
|
|
|
]) |
|
|
|
->assertSuccessful() |
|
|
|
; |
|
|
|
} |
|
|
|
} |