46 lines
1.7 KiB
PHP
46 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Functional;
|
|
|
|
use App\Factory\MenuFactory;
|
|
use App\Factory\PartitionFactory;
|
|
use App\Factory\UserFactory;
|
|
use App\Model\UserGroupPermissions;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
|
|
|
class PartitionTest extends AbstractTest
|
|
{
|
|
CONST string USER_ADMIN = 'ogadmin';
|
|
CONST string PARTITION_CREATE = 'test-partition-create';
|
|
CONST string PARTITION_UPDATE = 'test-partition-update';
|
|
CONST string PARTITION_DELETE = 'test-partition-delete';
|
|
|
|
/**
|
|
* @throws RedirectionExceptionInterface
|
|
* @throws DecodingExceptionInterface
|
|
* @throws ClientExceptionInterface
|
|
* @throws TransportExceptionInterface
|
|
* @throws ServerExceptionInterface
|
|
*/
|
|
public function testGetCollectionPartitions(): void
|
|
{
|
|
UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]);
|
|
|
|
PartitionFactory::createMany(10);
|
|
|
|
$this->createClientWithCredentials()->request('GET', '/partitions');
|
|
$this->assertResponseStatusCodeSame(Response::HTTP_OK);
|
|
$this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');
|
|
$this->assertJsonContains([
|
|
'@context' => '/contexts/Partition',
|
|
'@id' => '/partitions',
|
|
'@type' => 'hydra:Collection',
|
|
'hydra:totalItems' => 10,
|
|
]);
|
|
}
|
|
} |