Updated test
testing/ogcore-api/pipeline/head This commit looks good Details

pull/21/head
Manuel Aranda Rosales 2025-03-05 10:34:02 +01:00
parent 6ed2d7a936
commit 73b5914baa
3 changed files with 15 additions and 4 deletions

View File

@ -0,0 +1,3 @@
services:
App\EventListener\ClientStatusNotifier:
tags: ~ # Esto elimina el listener en el entorno de test

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
@ -14,11 +15,12 @@
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.6" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory suffix=".php">tests</directory>
<directory>tests</directory>
</testsuite>
</testsuites>
@ -28,6 +30,10 @@
</include>
</coverage>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
<extensions>
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension"/>
</extensions>

View File

@ -42,7 +42,9 @@ class ClientTest extends AbstractTest
{
UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]);
ClientFactory::createMany(10);
$ou = OrganizationalUnitFactory::new(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT])->create()->_disableAutoRefresh();
$ou->_save();
ClientFactory::createOne(['organizationalUnit' => $ou]);
$this->createClientWithCredentials()->request('GET', '/clients');
$this->assertResponseStatusCodeSame(Response::HTTP_OK);
@ -51,7 +53,7 @@ class ClientTest extends AbstractTest
'@context' => '/contexts/Client',
'@id' => '/clients',
'@type' => 'hydra:Collection',
'hydra:totalItems' => 10,
'hydra:totalItems' => 1,
]);
}