Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix PHPUnit tests
Browse files Browse the repository at this point in the history
loic425 committed Dec 5, 2023
1 parent 1983dc7 commit 6a9c448
Showing 8 changed files with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
namespace App\Tests\Controller;

use ApiTestCase\JsonApiTestCase;
use App\Kernel;
use Coduo\PHPMatcher\Backtrace\VoidBacktrace;
use Coduo\PHPMatcher\Matcher;
use Symfony\Component\HttpFoundation\Response;
@@ -71,7 +72,9 @@ public function it_does_not_allow_to_create_a_subscription_if_there_is_a_validat

$this->client->request('POST', '/ajax/subscriptions', [], [], ['CONTENT_TYPE' => 'application/json'], $data);

$this->assertResponse($this->client->getResponse(), 'subscriptions/create_validation', Response::HTTP_UNPROCESSABLE_ENTITY);
$file = Kernel::VERSION_ID >= 60400 ? 'subscriptions/create_validation' : 'subscriptions/create_validation_legacy';

$this->assertResponse($this->client->getResponse(), $file, Response::HTTP_UNPROCESSABLE_ENTITY);
}

/** @test */
@@ -105,7 +108,9 @@ public function it_does_not_allow_to_update_a_subscription_if_there_is_a_validat

$this->client->request('PUT', '/ajax/subscriptions/' . $subscriptions['subscription_marty']->getId(), [], [], ['CONTENT_TYPE' => 'application/json'], $data);

$this->assertResponse($this->client->getResponse(), 'subscriptions/update_validation', Response::HTTP_UNPROCESSABLE_ENTITY);
$file = Kernel::VERSION_ID >= 60400 ? 'subscriptions/update_validation' : 'subscriptions/update_validation_legacy';

$this->assertResponse($this->client->getResponse(), $file, Response::HTTP_UNPROCESSABLE_ENTITY);
}

/** @test */
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@

namespace App\Tests\Controller;

use App\Kernel;
use Coduo\PHPMatcher\Backtrace\VoidBacktrace;
use Coduo\PHPMatcher\Matcher;
use Symfony\Component\HttpFoundation\Response;
@@ -70,7 +71,9 @@ public function it_does_not_allow_to_create_a_subscription_if_there_is_a_validat

$this->client->request(method: 'POST', uri: '/ajax/subscriptions', server: self::$headersWithContentType, content: $data);

$this->assertResponse($this->client->getResponse(), 'subscriptions/create_validation', Response::HTTP_UNPROCESSABLE_ENTITY);
$file = Kernel::VERSION_ID >= 60400 ? 'subscriptions/create_validation' : 'subscriptions/create_validation_legacy';

$this->assertResponse($this->client->getResponse(), $file, Response::HTTP_UNPROCESSABLE_ENTITY);
}

/** @test */
@@ -104,7 +107,9 @@ public function it_does_not_allow_to_update_a_subscription_if_there_is_a_validat

$this->client->request(method: 'PUT', uri: '/ajax/subscriptions/' . $subscriptions['subscription_marty']->getId(), server: self::$headersWithContentType, content: $data);

$this->assertResponse($this->client->getResponse(), 'subscriptions/update_validation', Response::HTTP_UNPROCESSABLE_ENTITY);
$file = Kernel::VERSION_ID >= 60400 ? 'subscriptions/update_validation' : 'subscriptions/update_validation_legacy';

$this->assertResponse($this->client->getResponse(), $file, Response::HTTP_UNPROCESSABLE_ENTITY);
}

/** @test */
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
{
"propertyPath": "email",
"title": "This value should not be blank.",
"template": "This value should not be blank.",
"parameters": {
"{{ value }}": "\"\""
},
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
<violations>
<propertyPath>email</propertyPath>
<title>This value should not be blank.</title>
<template>This value should not be blank.</template>
<parameters>
<item key="{{ value }}">""</item>
</parameters>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "https://symfony.com/errors/validation",
"title": "Validation Failed",
"detail": "email: This value should not be blank.",
"violations": [
{
"propertyPath": "email",
"title": "This value should not be blank.",
"parameters": {
"{{ value }}": "\"\""
},
"type": "urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3"
}
]
}
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
{
"propertyPath": "email",
"title": "This value should not be blank.",
"template": "This value should not be blank.",
"parameters": {
"{{ value }}": "\"\""
},
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
<violations>
<propertyPath>email</propertyPath>
<title>This value should not be blank.</title>
<template>This value should not be blank.</template>
<parameters>
<item key="{{ value }}">""</item>
</parameters>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "https://symfony.com/errors/validation",
"title": "Validation Failed",
"detail": "email: This value should not be blank.",
"violations": [
{
"propertyPath": "email",
"title": "This value should not be blank.",
"parameters": {
"{{ value }}": "\"\""
},
"type": "urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3"
}
]
}

0 comments on commit 6a9c448

Please sign in to comment.