mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,15 +15,7 @@ use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\NativeQuery;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\HttpBrowser;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use function call_user_func;
|
||||
use function count;
|
||||
use function is_callable;
|
||||
use function is_string;
|
||||
|
||||
/**
|
||||
* This class provide a set of tests for exports.
|
||||
@@ -84,14 +76,12 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
$circles = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)
|
||||
->findAll();
|
||||
|
||||
if (count($centers) === 0) {
|
||||
throw new RuntimeException('No center found. Did you forget to '
|
||||
. 'run `doctrine:fixtures:load` command before ?');
|
||||
if (0 === \count($centers)) {
|
||||
throw new \RuntimeException('No center found. Did you forget to run `doctrine:fixtures:load` command before ?');
|
||||
}
|
||||
|
||||
if (count($circles) === 0) {
|
||||
throw new RuntimeException('No circle found. Did you forget to '
|
||||
. 'run `doctrine:fixtures:load` command before ?');
|
||||
if (0 === \count($circles)) {
|
||||
throw new \RuntimeException('No circle found. Did you forget to run `doctrine:fixtures:load` command before ?');
|
||||
}
|
||||
|
||||
return [[
|
||||
@@ -155,7 +145,7 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
$this->assertNotEmpty(
|
||||
$export->getDescription(),
|
||||
'Assert that the `getDescription` method does not return an empty '
|
||||
. 'string.'
|
||||
.'string.'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -176,7 +166,7 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
);
|
||||
$this->assertGreaterThanOrEqual(
|
||||
1,
|
||||
count($queryKeys),
|
||||
\count($queryKeys),
|
||||
'test that there are at least one query key returned'
|
||||
);
|
||||
}
|
||||
@@ -191,7 +181,7 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
* - each of this callable can provide a string for '_header'
|
||||
*
|
||||
* @param string[] $modifiers
|
||||
* @param array $acl
|
||||
* @param array $acl
|
||||
*
|
||||
* @dataProvider dataProviderInitiateQuery
|
||||
*/
|
||||
@@ -216,9 +206,9 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
'assert that the returned result is an array'
|
||||
);
|
||||
|
||||
if (count($results) === 0) {
|
||||
if (0 === \count($results)) {
|
||||
$this->markTestIncomplete('The result is empty. We cannot process tests '
|
||||
. 'on results');
|
||||
.'on results');
|
||||
}
|
||||
|
||||
// testing the result
|
||||
@@ -239,18 +229,18 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
$closure = $this->getExport()->getLabels($key, [$value], $data);
|
||||
|
||||
$this->assertTrue(
|
||||
is_callable($closure, false),
|
||||
\is_callable($closure, false),
|
||||
'test that the `getLabels` for key is a callable'
|
||||
);
|
||||
|
||||
$this->assertTrue(
|
||||
// conditions
|
||||
is_string((string) call_user_func($closure, '_header'))
|
||||
&& !empty(call_user_func($closure, '_header'))
|
||||
&& call_user_func($closure, '_header') !== '_header',
|
||||
\is_string((string) \call_user_func($closure, '_header'))
|
||||
&& !empty(\call_user_func($closure, '_header'))
|
||||
&& '_header' !== \call_user_func($closure, '_header'),
|
||||
// message
|
||||
sprintf('Test that the callable return by `getLabels` for key %s '
|
||||
. 'can provide an header', $key)
|
||||
.'can provide an header', $key)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -267,7 +257,7 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
'Assert that the `getType` method return a string'
|
||||
);
|
||||
$this->assertNotEmpty($export->getType(), 'Assert that the `getType` method'
|
||||
. ' does not return an empty string.');
|
||||
.' does not return an empty string.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -296,13 +286,13 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
if ($query instanceof QueryBuilder) {
|
||||
$this->assertGreaterThanOrEqual(
|
||||
1,
|
||||
count($query->getDQLPart('select')),
|
||||
\count($query->getDQLPart('select')),
|
||||
"assert there is at least one 'select' part"
|
||||
);
|
||||
|
||||
$this->assertGreaterThanOrEqual(
|
||||
1,
|
||||
count($query->getDQLPart('from')),
|
||||
\count($query->getDQLPart('from')),
|
||||
"assert there is at least one 'from' part"
|
||||
);
|
||||
} elseif ($query instanceof NativeQuery) {
|
||||
@@ -345,8 +335,8 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
);
|
||||
} elseif ($query instanceof NativeQuery) {
|
||||
$this->assertTrue(
|
||||
$export->supportsModifiers() === null
|
||||
|| count($export->supportsModifiers()) === 0,
|
||||
null === $export->supportsModifiers()
|
||||
|| 0 === \count($export->supportsModifiers()),
|
||||
'Test that the `supportsModifier` methods returns null or an empty array'
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user