Skip to content

Commit

Permalink
Update PHP deps
Browse files Browse the repository at this point in the history
Except phpunit/phpunit because v10 crash OKpilot tests with out of
memory error
  • Loading branch information
PowerKiKi committed Aug 28, 2023
1 parent 8c1a29e commit d595960
Show file tree
Hide file tree
Showing 9 changed files with 719 additions and 740 deletions.
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@
"ecodev/felix": "^11.6",
"ecodev/graphql-upload": "^6.1",
"infomaniak/client-api-newsletter": "^1.0",
"laminas/laminas-config-aggregator": "^1.11",
"laminas/laminas-http": "^2.17",
"laminas/laminas-servicemanager": "^3.19",
"mezzio/mezzio": "^3.13",
"mezzio/mezzio-fastroute": "^3.7",
"mezzio/mezzio-helpers": "^5.11",
"mezzio/mezzio-laminasviewrenderer": "^2.9",
"mezzio/mezzio-session-ext": "^1.14",
"roave/psr-container-doctrine": "^3.6"
"laminas/laminas-config-aggregator": "^1.13",
"laminas/laminas-http": "^2.18",
"laminas/laminas-servicemanager": "^3.21",
"mezzio/mezzio": "^3.17",
"mezzio/mezzio-fastroute": "^3.10",
"mezzio/mezzio-helpers": "^5.15",
"mezzio/mezzio-laminasviewrenderer": "^2.14",
"mezzio/mezzio-session-ext": "^1.18",
"roave/psr-container-doctrine": "^3.9"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "@stable",
"laminas/laminas-development-mode": "^3.10",
"laminas/laminas-development-mode": "^3.11",
"phpstan/phpstan-doctrine": "@stable",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.6"
}
}
1,371 changes: 675 additions & 696 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion server/Application/Api/TypesFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ public function __invoke(ContainerInterface $container): Types
\GraphQL\Upload\UploadType::class,
];

$invokables = array_combine($invokables, $invokables);

$aliases = [
\Cake\Chronos\Chronos::class => \Ecodev\Felix\Api\Scalar\ChronosType::class,
\Cake\Chronos\Date::class => \Ecodev\Felix\Api\Scalar\DateType::class,
\Cake\Chronos\ChronosDate::class => \Ecodev\Felix\Api\Scalar\DateType::class,
'datetime' => \Ecodev\Felix\Api\Scalar\ChronosType::class,
'date' => \Ecodev\Felix\Api\Scalar\DateType::class,
\Psr\Http\Message\UploadedFileInterface::class => \GraphQL\Upload\UploadType::class,
Expand Down
8 changes: 4 additions & 4 deletions server/Application/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Application\Api\Input\Sorting\Illustration;
use Application\Repository\ProductRepository;
use Cake\Chronos\Date;
use Cake\Chronos\ChronosDate;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
Expand All @@ -24,7 +24,7 @@ class Product extends AbstractProduct
private ?int $readingDuration = null;

#[ORM\Column(type: 'date', nullable: true)]
private ?Date $releaseDate = null;
private ?ChronosDate $releaseDate = null;

#[ORM\Column(type: 'smallint', nullable: true, unique: true, options: ['unsigned' => true])]
private ?int $reviewNumber = null;
Expand Down Expand Up @@ -104,12 +104,12 @@ public function setReadingDuration(?int $readingDuration): void
$this->readingDuration = $readingDuration;
}

public function getReleaseDate(): ?Date
public function getReleaseDate(): ?ChronosDate
{
return $this->releaseDate;
}

public function setReleaseDate(?Date $releaseDate): void
public function setReleaseDate(?ChronosDate $releaseDate): void
{
$this->releaseDate = $releaseDate;
}
Expand Down
14 changes: 7 additions & 7 deletions server/Application/Model/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Application\Repository\SessionRepository;
use Application\Traits\HasRichTextDescription;
use Cake\Chronos\Date;
use Cake\Chronos\ChronosDate;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
Expand Down Expand Up @@ -53,13 +53,13 @@ class Session extends AbstractModel
* Used for filter + sorting. Represents the first date.
*/
#[ORM\Column(type: 'date')]
private Date $startDate;
private ChronosDate $startDate;

/**
* Used for filter + sorting. Represents the first date.
*/
#[ORM\Column(type: 'date')]
private Date $endDate;
private ChronosDate $endDate;

/**
* @var Collection<User>
Expand Down Expand Up @@ -152,22 +152,22 @@ public function setDates(array $dates): void
$this->dates = $dates;
}

public function getStartDate(): Date
public function getStartDate(): ChronosDate
{
return $this->startDate;
}

public function setStartDate(Date $startDate): void
public function setStartDate(ChronosDate $startDate): void
{
$this->startDate = $startDate;
}

public function getEndDate(): Date
public function getEndDate(): ChronosDate
{
return $this->endDate;
}

public function setEndDate(Date $endDate): void
public function setEndDate(ChronosDate $endDate): void
{
$this->endDate = $endDate;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ApplicationTest/Repository/FileRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Application\Model\Product;
use Application\Repository\FileRepository;
use ApplicationTest\Traits\LimitedAccessSubQuery;
use Cake\Chronos\Date;
use Cake\Chronos\ChronosDate;

class FileRepositoryTest extends AbstractRepositoryTest
{
Expand Down Expand Up @@ -41,7 +41,7 @@ public function providerGetAccessibleSubQuery(): iterable
public function testFileOnDiskIsDeletedWhenRecordInDbIsDeleted(): void
{
$product = new Product('p1');
$product->setReleaseDate(new Date());
$product->setReleaseDate(new ChronosDate());
$product->setReviewNumber(1);
$product->setType(ProductTypeType::BOTH);
$file = new File();
Expand Down
26 changes: 13 additions & 13 deletions tests/ApplicationTest/Service/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,80 +14,80 @@ class ImporterTest extends TestCase

public function testInvalidFilename(): void
{
$this->expectErrorMessage('File not found: non-existing-filename.csv');
$this->expectExceptionMessage('File not found: non-existing-filename.csv');
$this->import('non-existing-filename.csv');
}

public function testInvalidEmail(): void
{
$this->expectErrorMessage('A la ligne 1 : Ce n\'est pas une addresse email valide : "fo[o"');
$this->expectExceptionMessage('A la ligne 1 : Ce n\'est pas une addresse email valide : "fo[o"');
$this->import('tests/data/importer/invalid-email.csv');
}

public function testInvalidPattern(): void
{
$this->expectErrorMessage('A la ligne 1 : Ce n\'est pas une expression régulière valide : "fo[o"');
$this->expectExceptionMessage('A la ligne 1 : Ce n\'est pas une expression régulière valide : "fo[o"');
$this->import('tests/data/importer/invalid-pattern.csv');
}

public function testInvalidPatternEnding(): void
{
$this->expectErrorMessage('A la ligne 1 : L\'expression régulière ne peut pas commencer ou terminer par `|`, car c\'est trop dangeureux: "foo|"');
$this->expectExceptionMessage('A la ligne 1 : L\'expression régulière ne peut pas commencer ou terminer par `|`, car c\'est trop dangeureux: "foo|"');
$this->import('tests/data/importer/invalid-pattern-ending.csv');
}

public function testInvalidEmpty(): void
{
$this->expectErrorMessage('A la ligne 1 : Il faut soit un email, soit un pattern, mais aucun existe');
$this->expectExceptionMessage('A la ligne 1 : Il faut soit un email, soit un pattern, mais aucun existe');
$this->import('tests/data/importer/invalid-empty.csv');
}

public function testInvalidDuplicatedEmail(): void
{
$this->expectErrorMessage("A la ligne 3 : L'email \"foo@example.com\" est dupliqué et a déjà été vu à la ligne 1");
$this->expectExceptionMessage("A la ligne 3 : L'email \"foo@example.com\" est dupliqué et a déjà été vu à la ligne 1");
$this->import('tests/data/importer/invalid-duplicated-email.csv');
}

public function testInvalidDuplicatedPattern(): void
{
$this->expectErrorMessage('A la ligne 2 : Le pattern ".*@university\.com" est dupliqué et a déjà été vu à la ligne 1');
$this->expectExceptionMessage('A la ligne 2 : Le pattern ".*@university\.com" est dupliqué et a déjà été vu à la ligne 1');
$this->import('tests/data/importer/invalid-duplicated-pattern.csv');
}

public function testInvalidReviewNumber(): void
{
$this->expectErrorMessage('A la ligne 1 : Un numéro de revue doit être entièrement numérique, mais est : "foo"');
$this->expectExceptionMessage('A la ligne 1 : Un numéro de revue doit être entièrement numérique, mais est : "foo"');
$this->import('tests/data/importer/invalid-review-number.csv');
}

public function testInvalidMissingReviewNumber(): void
{
$this->expectErrorMessage('A la ligne 1 : Revue introuvable pour le numéro de revue : 123');
$this->expectExceptionMessage('A la ligne 1 : Revue introuvable pour le numéro de revue : 123');
$this->import('tests/data/importer/invalid-missing-review-number.csv');
}

public function testInvalidColumnCount(): void
{
$this->expectErrorMessage('A la ligne 1 : Doit avoir exactement 14 colonnes, mais en a 5');
$this->expectExceptionMessage('A la ligne 1 : Doit avoir exactement 14 colonnes, mais en a 5');
$this->import('tests/data/importer/invalid-column-count.csv');
}

public function testInvalidSubscriptionType(): void
{
$this->expectErrorMessage('A la ligne 1 : Le subscriptionType est invalide : "foo"');
$this->expectExceptionMessage('A la ligne 1 : Le subscriptionType est invalide : "foo"');
$this->import('tests/data/importer/invalid-subscription-type.csv');
}

public function testInvalidMultipleErrors(): void
{
$this->expectErrorMessage('A la ligne 1 : Pays "suise" introuvable. Vouliez-vous dire "SUISSE" ?
$this->expectExceptionMessage('A la ligne 1 : Pays "suise" introuvable. Vouliez-vous dire "SUISSE" ?
A la ligne 2 : Revue introuvable pour le numéro de revue : 123');
$this->import('tests/data/importer/invalid-multiple-errors.csv');
}

public function testFuzzyCountry(): void
{
$this->expectErrorMessage('A la ligne 1 : Pays "suise" introuvable. Vouliez-vous dire "SUISSE" ?');
$this->expectExceptionMessage('A la ligne 1 : Pays "suise" introuvable. Vouliez-vous dire "SUISSE" ?');

$this->import('tests/data/importer/invalid-country.csv');
}
Expand Down
5 changes: 2 additions & 3 deletions tests/data/query/anonymous-can-confirm-registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
'confirmRegistration' => true,
],
],
function (\Doctrine\DBAL\Connection $connection): void {

function (Doctrine\DBAL\Connection $connection): void {
// create a valid token for right now
$connection->update(
'user',
[
'token' => '09876543210987654321098765432109',
'token_creation_date' => \Cake\Chronos\Chronos::now()->subMinute(1)->toIso8601String(),
'token_creation_date' => \Cake\Chronos\Chronos::now()->subMinutes(1)->toIso8601String(),
],
[
'email' => 'administrator@example.com',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
'updatePassword' => true,
],
],
function (\Doctrine\DBAL\Connection $connection): void {

function (Doctrine\DBAL\Connection $connection): void {
// create a valid token for right now
$connection->update(
'user',
[
'token' => '09876543210987654321098765432109',
'token_creation_date' => \Cake\Chronos\Chronos::now()->subMinute(1)->toIso8601String(),
'token_creation_date' => \Cake\Chronos\Chronos::now()->subMinutes(1)->toIso8601String(),
],
[
'email' => 'administrator@example.com',
Expand Down

0 comments on commit d595960

Please sign in to comment.