Release 2.21.0 (#5014)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace API\Authentication;
|
||||
namespace App\Tests\API\Authentication;
|
||||
|
||||
use App\API\Authentication\AccessTokenHandler;
|
||||
use App\Entity\AccessToken;
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace API;
|
||||
namespace App\Tests\API;
|
||||
|
||||
use App\DataFixtures\UserFixtures;
|
||||
use App\Entity\User;
|
||||
use App\Tests\API\APIControllerBaseTest;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
|
||||
@@ -178,18 +178,19 @@ abstract class ControllerBaseTest extends WebTestCase
|
||||
|
||||
/** @var RedirectResponse $response */
|
||||
$response = $client->getResponse();
|
||||
self::assertInstanceOf(RedirectResponse::class, $response);
|
||||
|
||||
self::assertTrue(
|
||||
$response->isRedirect(),
|
||||
\sprintf('The secure URL %s is not protected.', $url)
|
||||
\sprintf('The URL %s is not protected (%s occurred).', $url, $response->getStatusCode())
|
||||
);
|
||||
|
||||
self::assertStringEndsWith(
|
||||
'/login',
|
||||
$response->getTargetUrl(),
|
||||
\sprintf('The secure URL %s does not redirect to the login form.', $url)
|
||||
\sprintf('The URL %s does not redirect to the login form.', $url)
|
||||
);
|
||||
|
||||
self::assertInstanceOf(RedirectResponse::class, $response);
|
||||
}
|
||||
|
||||
protected function assertSuccessResponse(HttpKernelBrowser $client, string $message = ''): void
|
||||
|
||||
@@ -18,27 +18,26 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
*/
|
||||
class DurationStringToSecondsTransformerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var DurationStringToSecondsTransformer
|
||||
*/
|
||||
private $sut;
|
||||
private DurationStringToSecondsTransformer $sut;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->sut = new DurationStringToSecondsTransformer();
|
||||
}
|
||||
|
||||
public function getValidTestDataTransform()
|
||||
public function getValidTestDataTransform(): array
|
||||
{
|
||||
return [
|
||||
['0:00', '0'],
|
||||
['123:00', '442800'],
|
||||
['123:00', 442800],
|
||||
['0:00', 0],
|
||||
['2:00', 7213], // by default no seconds are returned
|
||||
[null, null],
|
||||
];
|
||||
}
|
||||
|
||||
public function getInvalidTestDataTransform()
|
||||
public function getInvalidTestDataTransform(): array
|
||||
{
|
||||
return [
|
||||
[''],
|
||||
@@ -59,12 +58,14 @@ class DurationStringToSecondsTransformerTest extends TestCase
|
||||
*/
|
||||
public function testInvalidTransformThrowsException($transform): void
|
||||
{
|
||||
$this->expectException(TransformationFailedException::class);
|
||||
|
||||
$this->sut->transform($transform);
|
||||
$value = $this->sut->transform($transform);
|
||||
$this->assertNull($value);
|
||||
}
|
||||
|
||||
public function getValidTestDataReverseTransform()
|
||||
/**
|
||||
* @return array<int, array<int, string|int|float|null>>
|
||||
*/
|
||||
public function getValidTestDataReverseTransform(): array
|
||||
{
|
||||
return [
|
||||
['2h3s', 7203],
|
||||
@@ -72,16 +73,23 @@ class DurationStringToSecondsTransformerTest extends TestCase
|
||||
['0', null],
|
||||
[null, null],
|
||||
['87600000000:00:00', 315360000000000],
|
||||
[87600000000, 315360000000000], // int will be treated we could argue if this is a correct behavior
|
||||
[87599999999.5, 315359999998200], // only int can be used as hourly input
|
||||
];
|
||||
}
|
||||
|
||||
public function getInvalidTestDataReverseTransform()
|
||||
/**
|
||||
* @return array<int, array<int, string|int>>
|
||||
*/
|
||||
public function getInvalidTestDataReverseTransform(): array
|
||||
{
|
||||
return [
|
||||
['xxx'],
|
||||
[':::'],
|
||||
['0::0'],
|
||||
// too large
|
||||
['87600000000:00:01'],
|
||||
// too large
|
||||
[315360000000001],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class TranslationsTest extends TestCase
|
||||
|
||||
foreach ($body->children() as $transUnit) {
|
||||
preg_match_all('/%[a-zA-Z]{1,}%/Uu', (string) $transUnit->target, $matches);
|
||||
if (!empty($matches) && !empty($matches[0])) {
|
||||
if (!empty($matches[0])) {
|
||||
asort($matches[0]);
|
||||
$trans[(string) $transUnit->source] = array_values($matches[0]);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ parameters:
|
||||
doctrine:
|
||||
objectManagerLoader: %rootDir%/../../../tests/phpstan-doctrine.php
|
||||
ignoreErrors:
|
||||
- identifier: missingType.iterableValue
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\APIControllerBaseTest\\:\\:assertApiException\\(\\) has parameter \\$expectedErrors with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -2108,26 +2109,6 @@ parameters:
|
||||
count: 1
|
||||
path: Form/CustomerEditFormTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\DataTransformer\\\\DurationStringToSecondsTransformerTest\\:\\:getInvalidTestDataReverseTransform\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/DataTransformer/DurationStringToSecondsTransformerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\DataTransformer\\\\DurationStringToSecondsTransformerTest\\:\\:getInvalidTestDataTransform\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/DataTransformer/DurationStringToSecondsTransformerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\DataTransformer\\\\DurationStringToSecondsTransformerTest\\:\\:getValidTestDataReverseTransform\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/DataTransformer/DurationStringToSecondsTransformerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\DataTransformer\\\\DurationStringToSecondsTransformerTest\\:\\:getValidTestDataTransform\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/DataTransformer/DurationStringToSecondsTransformerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\DataTransformer\\\\DurationStringToSecondsTransformerTest\\:\\:testInvalidReverseTransformThrowsException\\(\\) has parameter \\$transform with no type specified\\.$#"
|
||||
count: 1
|
||||
|
||||
Reference in New Issue
Block a user