diff --git a/site/app/DateTime/DateTimeFactory.php b/site/app/DateTime/DateTimeFactory.php index 56973d5f0..c2f9a9d7d 100644 --- a/site/app/DateTime/DateTimeFactory.php +++ b/site/app/DateTime/DateTimeFactory.php @@ -9,7 +9,6 @@ use Exception; use MichalSpacekCz\DateTime\Exceptions\CannotCreateDateTimeObjectException; use MichalSpacekCz\DateTime\Exceptions\CannotParseDateTimeException; -use MichalSpacekCz\DateTime\Exceptions\InvalidTimezoneException; readonly class DateTimeFactory { @@ -36,14 +35,12 @@ public function createFromFormat(string $format, string $datetime, ?DateTimeZone /** - * @throws InvalidTimezoneException * @throws CannotCreateDateTimeObjectException */ - public function createFrom(DateTimeInterface $dateTime, ?string $timezoneId = null): DateTimeImmutable + public function createFrom(DateTimeInterface $dateTime, string $timezoneId): DateTimeImmutable { - $timezone = $timezoneId !== null ? $this->dateTimeZoneFactory->get($timezoneId) : null; try { - return new DateTimeImmutable($dateTime->format('Y-m-d H:i:s.u'), $timezone); + return new DateTimeImmutable($dateTime->format('Y-m-d H:i:s.u'), $this->dateTimeZoneFactory->get($timezoneId)); } catch (Exception $e) { throw new CannotCreateDateTimeObjectException($e); } diff --git a/site/app/Test/Database/Database.php b/site/app/Test/Database/Database.php index f58649947..746ff6fa3 100644 --- a/site/app/Test/Database/Database.php +++ b/site/app/Test/Database/Database.php @@ -25,7 +25,7 @@ class Database extends Explorer /** @var array>> */ private array $queriesArrayParams = []; - /** @var array */ + /** @var array */ private array $fetchResult = []; private mixed $fetchFieldDefaultResult = null; @@ -156,7 +156,7 @@ public function getParamsArrayForQuery(string $query): array /** - * @param array $fetchResult + * @param array $fetchResult */ public function setFetchResult(array $fetchResult): void { @@ -230,7 +230,7 @@ public function fetchPairs(string $sql, ...$params): array /** - * @param list> $fetchAllDefaultResult + * @param list> $fetchAllDefaultResult * @return void */ public function setFetchAllDefaultResult(array $fetchAllDefaultResult): void @@ -240,7 +240,7 @@ public function setFetchAllDefaultResult(array $fetchAllDefaultResult): void /** - * @param list> $fetchAllResult + * @param list> $fetchAllResult * @return void */ public function addFetchAllResult(array $fetchAllResult): void @@ -250,7 +250,7 @@ public function addFetchAllResult(array $fetchAllResult): void /** - * @param list> $fetchAllResult + * @param list> $fetchAllResult * @return list */ private function getRows(array $fetchAllResult): array @@ -278,7 +278,7 @@ public function fetchAll(string $sql, ...$params): array /** * Almost the same as Row::from() but with better/simpler types. * - * @param array $array + * @param array $array */ private function createRow(array $array): Row { diff --git a/site/app/Training/Applications/TrainingApplication.php b/site/app/Training/Applications/TrainingApplication.php index 1c36d0061..e57ca559f 100644 --- a/site/app/Training/Applications/TrainingApplication.php +++ b/site/app/Training/Applications/TrainingApplication.php @@ -66,7 +66,7 @@ public function __construct( private readonly ?float $priceVat, private readonly string $priceWithCurrency, private readonly string $priceVatWithCurrency, - private readonly ?float $discount, + private readonly ?int $discount, private ?int $invoiceId, private readonly ?DateTime $paid, private readonly string $accessToken, @@ -323,7 +323,7 @@ public function getPriceVatWithCurrency(): string } - public function getDiscount(): ?float + public function getDiscount(): ?int { return $this->discount; } diff --git a/site/app/Training/Company/CompanyTraining.php b/site/app/Training/Company/CompanyTraining.php index 50515bbfb..bdebf4815 100644 --- a/site/app/Training/Company/CompanyTraining.php +++ b/site/app/Training/Company/CompanyTraining.php @@ -12,20 +12,20 @@ public function __construct( private int $id, private string $action, private Html $name, - private ?Html $description, + private Html $description, private Html $content, - private ?Html $upsell, + private Html $upsell, private ?Html $prerequisites, private ?Html $audience, private ?int $capacity, - private ?int $price, - private ?int $alternativeDurationPrice, + private int $price, + private int $alternativeDurationPrice, private ?int $studentDiscount, private ?Html $materials, private bool $custom, private Html $duration, private Html $alternativeDuration, - private ?Html $alternativeDurationPriceText, + private Html $alternativeDurationPriceText, private ?int $successorId, private ?int $discontinuedId, ) { diff --git a/site/app/Training/Company/CompanyTrainings.php b/site/app/Training/Company/CompanyTrainings.php index 3fa8293b9..fa42a5b87 100644 --- a/site/app/Training/Company/CompanyTrainings.php +++ b/site/app/Training/Company/CompanyTrainings.php @@ -109,20 +109,18 @@ public function getWithoutPublicUpcoming(): array private function createFromDatabaseRow(Row $row): CompanyTraining { - if (isset($row->alternativeDurationPriceText)) { - $price = $this->prices->resolvePriceVat($row->alternativeDurationPrice); - $alternativeDurationPriceText = $this->texyFormatter->translate($row->alternativeDurationPriceText, [ - $price->getPriceWithCurrency(), - $price->getPriceVatWithCurrency(), - ]); - } + $price = $this->prices->resolvePriceVat($row->alternativeDurationPrice); + $alternativeDurationPriceText = $this->texyFormatter->translate($row->alternativeDurationPriceText, [ + $price->getPriceWithCurrency(), + $price->getPriceVatWithCurrency(), + ]); return new CompanyTraining( $row->id, $row->action, $this->texyFormatter->translate($row->name), - $row->description ? $this->texyFormatter->translate($row->description) : null, + $this->texyFormatter->translate($row->description), $this->texyFormatter->translate($row->content), - $row->upsell ? $this->texyFormatter->translate($row->upsell) : null, + $this->texyFormatter->translate($row->upsell), $row->prerequisites ? $this->texyFormatter->translate($row->prerequisites) : null, $row->audience ? $this->texyFormatter->translate($row->audience) : null, $row->capacity, @@ -133,7 +131,7 @@ private function createFromDatabaseRow(Row $row): CompanyTraining (bool)$row->custom, $this->texyFormatter->translate($row->duration), $this->texyFormatter->translate($row->alternativeDuration), - $alternativeDurationPriceText ?? null, + $alternativeDurationPriceText, $row->successorId, $row->discontinuedId, ); diff --git a/site/app/Training/Dates/TrainingDateFactory.php b/site/app/Training/Dates/TrainingDateFactory.php index 68fae0ac8..c32d7e747 100644 --- a/site/app/Training/Dates/TrainingDateFactory.php +++ b/site/app/Training/Dates/TrainingDateFactory.php @@ -35,7 +35,7 @@ public function get(Row $row): TrainingDate $this->lastFreeSeats($row->start, $status), $row->start, $row->end, - $row->labelJson ? Json::decode($row->labelJson)->{$this->translator->getDefaultLocale()} : null, + $this->getLabelFromJson($row->labelJson), $row->labelJson, (bool)$row->public, $status, @@ -70,4 +70,17 @@ private function lastFreeSeats(DateTime $start, TrainingDateStatus $status): boo return ($start->diff($now)->days <= self::LAST_FREE_SEATS_THRESHOLD_DAYS && $start > $now && $status !== TrainingDateStatus::Tentative); } + + private function getLabelFromJson(?string $json): ?string + { + if ($json !== null) { + $labels = Json::decode($json); + $label = $labels->{$this->translator->getDefaultLocale()} ?? null; + if (!is_string($label)) { + return null; + } + } + return $label ?? null; + } + } diff --git a/site/psalm-baseline.xml b/site/psalm-baseline.xml index 15dcac385..3977a18cf 100644 --- a/site/psalm-baseline.xml +++ b/site/psalm-baseline.xml @@ -1,5 +1,5 @@ - + slugTags]]> @@ -666,11 +666,9 @@ - action]]> alternativeDuration]]> alternativeDurationPrice]]> - alternativeDurationPrice]]> alternativeDurationPriceText]]> audience]]> capacity]]> @@ -698,8 +696,6 @@ end]]> feedbackHref]]> labelJson]]> - labelJson]]> - labelJson ? Json::decode($row->labelJson)->{$this->translator->getDefaultLocale()} : null]]> note]]> price]]> remoteNotes]]> diff --git a/site/tests/DateTime/DateTimeFactoryTest.phpt b/site/tests/DateTime/DateTimeFactoryTest.phpt index bdf0c775c..282ed4a11 100644 --- a/site/tests/DateTime/DateTimeFactoryTest.phpt +++ b/site/tests/DateTime/DateTimeFactoryTest.phpt @@ -5,6 +5,7 @@ declare(strict_types = 1); namespace MichalSpacekCz\DateTime; use DateTimeImmutable; +use MichalSpacekCz\DateTime\Exceptions\CannotCreateDateTimeObjectException; use MichalSpacekCz\DateTime\Exceptions\CannotParseDateTimeException; use MichalSpacekCz\DateTime\Exceptions\InvalidTimezoneException; use MichalSpacekCz\Test\TestCaseRunner; @@ -38,10 +39,6 @@ class DateTimeFactoryTest extends TestCase public function testCreateFrom(): void { - Assert::exception(function (): void { - $this->dateTimeFactory->createFrom(new DateTimeImmutable(), 'Europe/Brno'); - }, InvalidTimezoneException::class, "Invalid timezone 'Europe/Brno'"); - $niceDate = '2020-10-10 20:30:40'; $niceDateTime = new DateTimeImmutable("{$niceDate} UTC"); $newDateTime = $this->dateTimeFactory->createFrom($niceDateTime, 'Europe/Prague'); @@ -50,6 +47,24 @@ class DateTimeFactoryTest extends TestCase Assert::notSame($niceDateTime->getTimestamp(), $newDateTime->getTimestamp()); } + + public function testCreateFromInvalidTimezone(): void + { + $e = Assert::exception(function (): void { + $this->dateTimeFactory->createFrom(new DateTimeImmutable(), 'Europe/Brno'); + }, CannotCreateDateTimeObjectException::class, 'Cannot create a DateTime or DateTimeImmutable object'); + if (!$e instanceof CannotCreateDateTimeObjectException) { + Assert::fail('Exception is of a wrong type ' . get_debug_type($e)); + } else { + $previous = $e->getPrevious(); + if (!$previous instanceof InvalidTimeZoneException) { + Assert::fail('Previous exception is of a wrong type ' . get_debug_type($previous)); + } else { + Assert::same("Invalid timezone 'Europe/Brno'", $previous->getMessage()); + } + } + } + } TestCaseRunner::run(DateTimeFactoryTest::class); diff --git a/site/tests/Formatter/TexyFormatterTest.phpt b/site/tests/Formatter/TexyFormatterTest.phpt index 0daba48bd..c65cfd42d 100644 --- a/site/tests/Formatter/TexyFormatterTest.phpt +++ b/site/tests/Formatter/TexyFormatterTest.phpt @@ -49,14 +49,14 @@ class TexyFormatterTest extends TestCase 'name' => 'Bezpečnost PHP aplikací', 'price' => 3490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-01-05 04:03:02'), 'end' => new DateTime('2020-01-07 04:03:02'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', 'status' => 'CONFIRMED', - 'public' => false, - 'remote' => true, + 'public' => 0, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 1, @@ -80,14 +80,14 @@ class TexyFormatterTest extends TestCase 'name' => 'Bezpečnost PHP aplikací', 'price' => 4490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-02-05 04:03:02'), 'end' => new DateTime('2020-02-07 04:03:02'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', 'status' => 'CONFIRMED', - 'public' => true, - 'remote' => false, + 'public' => 1, + 'remote' => 0, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 2, diff --git a/site/tests/Pulse/Passwords/PasswordsTest.phpt b/site/tests/Pulse/Passwords/PasswordsTest.phpt index bdf956dc5..9ed4eea86 100644 --- a/site/tests/Pulse/Passwords/PasswordsTest.phpt +++ b/site/tests/Pulse/Passwords/PasswordsTest.phpt @@ -41,10 +41,10 @@ class PasswordsTest extends TestCase 'algoId' => 1, 'algoAlias' => 'bcrypt', 'algoName' => 'bcrypt', - 'algoSalted' => true, - 'algoStretched' => true, + 'algoSalted' => 1, + 'algoStretched' => 1, 'from' => new DateTime('2014-06-23 00:00:00'), - 'fromConfirmed' => true, + 'fromConfirmed' => 1, 'disclosureId' => 6, 'disclosureUrl' => 'https://twitter.com/petrsoukup/status/481077407722774528', 'disclosureArchive' => 'https://web.archive.org/web/20160721160917/https://twitter.com/petrsoukup/status/481077407722774528', @@ -69,10 +69,10 @@ class PasswordsTest extends TestCase 'algoId' => 3, 'algoAlias' => 'sha256', 'algoName' => 'SHA-256', - 'algoSalted' => false, - 'algoStretched' => false, + 'algoSalted' => 0, + 'algoStretched' => 0, 'from' => null, - 'fromConfirmed' => false, + 'fromConfirmed' => 0, 'disclosureId' => 6, 'disclosureUrl' => 'https://twitter.com/petrsoukup/status/481077407722774528', 'disclosureArchive' => 'https://web.archive.org/web/20160721160917/https://twitter.com/petrsoukup/status/481077407722774528', @@ -97,10 +97,10 @@ class PasswordsTest extends TestCase 'algoId' => 10, 'algoAlias' => 'argon2', 'algoName' => 'Argon2', - 'algoSalted' => true, - 'algoStretched' => true, + 'algoSalted' => 1, + 'algoStretched' => 1, 'from' => new DateTime('2018-02-05 00:00:00'), - 'fromConfirmed' => true, + 'fromConfirmed' => 1, 'disclosureId' => 121, 'disclosureUrl' => 'https://www.zlavomat.sk/kontakt#je-moje-heslo-u-vas-ulozene-bezpecne', 'disclosureArchive' => 'https://web.archive.org/web/20180205182943/https://www.zlavomat.sk/kontakt#je-moje-heslo-u-vas-ulozene-bezpecne', @@ -125,10 +125,10 @@ class PasswordsTest extends TestCase 'algoId' => 1, 'algoAlias' => 'bcrypt', 'algoName' => 'bcrypt', - 'algoSalted' => true, - 'algoStretched' => true, + 'algoSalted' => 1, + 'algoStretched' => 1, 'from' => new DateTime('2014-05-01 00:00:00'), - 'fromConfirmed' => true, + 'fromConfirmed' => 1, 'disclosureId' => 2, 'disclosureUrl' => 'https://twitter.com/spazef0rze/status/476468449196404738', 'disclosureArchive' => 'https://web.archive.org/web/20160721160007/https:/twitter.com/spazef0rze/status/476468449196404738', @@ -153,10 +153,10 @@ class PasswordsTest extends TestCase 'algoId' => 1, 'algoAlias' => 'bcrypt', 'algoName' => 'bcrypt', - 'algoSalted' => true, - 'algoStretched' => true, + 'algoSalted' => 1, + 'algoStretched' => 1, 'from' => new DateTime('2014-05-01 00:00:00'), - 'fromConfirmed' => true, + 'fromConfirmed' => 1, 'disclosureId' => 1, 'disclosureUrl' => 'https://www.michalspacek.cz/prednasky/jak-jsme-zlepsili-zabezpeceni-slevomatu-pixdevday/bcrypt-aes', 'disclosureArchive' => 'https://archive.is/A5bfH', @@ -181,10 +181,10 @@ class PasswordsTest extends TestCase 'algoId' => 1, 'algoAlias' => 'bcrypt', 'algoName' => 'bcrypt', - 'algoSalted' => true, - 'algoStretched' => true, + 'algoSalted' => 1, + 'algoStretched' => 1, 'from' => new DateTime('2014-05-01 00:00:00'), - 'fromConfirmed' => true, + 'fromConfirmed' => 1, 'disclosureId' => 75, 'disclosureUrl' => 'https://www.zlavomat.sk/kontakt#je-moje-heslo-u-vas-ulozene-bezpecne', 'disclosureArchive' => 'https://archive.is/RbQtI', @@ -209,10 +209,10 @@ class PasswordsTest extends TestCase 'algoId' => 2, 'algoAlias' => 'sha1', 'algoName' => 'SHA-1', - 'algoSalted' => false, - 'algoStretched' => false, + 'algoSalted' => 0, + 'algoStretched' => 0, 'from' => null, - 'fromConfirmed' => false, + 'fromConfirmed' => 0, 'disclosureId' => 2, 'disclosureUrl' => 'https://twitter.com/spazef0rze/status/476468449196404738', 'disclosureArchive' => 'https://web.archive.org/web/20160721160007/https:/twitter.com/spazef0rze/status/476468449196404738', @@ -237,10 +237,10 @@ class PasswordsTest extends TestCase 'algoId' => 2, 'algoAlias' => 'sha1', 'algoName' => 'SHA-1', - 'algoSalted' => false, - 'algoStretched' => false, + 'algoSalted' => 0, + 'algoStretched' => 0, 'from' => null, - 'fromConfirmed' => false, + 'fromConfirmed' => 0, 'disclosureId' => 3, 'disclosureUrl' => 'https://www.michalspacek.cz/prednasky/jak-jsme-zlepsili-zabezpeceni-slevomatu-pixdevday/sha1', 'disclosureArchive' => 'https://archive.is/FfPit', @@ -265,10 +265,10 @@ class PasswordsTest extends TestCase 'algoId' => 1, 'algoAlias' => 'bcrypt', 'algoName' => 'bcrypt', - 'algoSalted' => true, - 'algoStretched' => true, + 'algoSalted' => 1, + 'algoStretched' => 1, 'from' => null, - 'fromConfirmed' => false, + 'fromConfirmed' => 0, 'disclosureId' => 158, 'disclosureUrl' => 'https://blog.webalert.cz/2018/07/jak-ukladame-vase-hesla.html', 'disclosureArchive' => 'https://web.archive.org/web/20180719115018/https://blog.webalert.cz/2018/07/jak-ukladame-vase-hesla.html', diff --git a/site/tests/Tls/CertificateFactoryTest.phpt b/site/tests/Tls/CertificateFactoryTest.phpt index 2131c96fb..46b37c424 100644 --- a/site/tests/Tls/CertificateFactoryTest.phpt +++ b/site/tests/Tls/CertificateFactoryTest.phpt @@ -4,6 +4,7 @@ declare(strict_types = 1); namespace MichalSpacekCz\Tls; +use DateTime; use DateTimeImmutable; use MichalSpacekCz\DateTime\DateTimeFormat; use MichalSpacekCz\Test\TestCaseRunner; @@ -81,9 +82,9 @@ class CertificateFactoryTest extends TestCase $row = new Row(); $row->cn = 'foo.example'; $row->ext = 'ec'; - $row->notBefore = new DateTimeImmutable('2020-10-05 04:03:02'); + $row->notBefore = new DateTime('2020-10-05 04:03:02'); $row->notBeforeTimezone = 'UTC'; - $row->notAfter = new DateTimeImmutable('2021-11-06 14:13:12'); + $row->notAfter = new DateTime('2021-11-06 14:13:12'); $row->notAfterTimezone = 'Europe/Prague'; $certificate = $this->certificateFactory->fromDatabaseRow($row); diff --git a/site/tests/Training/Dates/TrainingDateFactoryTest.phpt b/site/tests/Training/Dates/TrainingDateFactoryTest.phpt new file mode 100644 index 000000000..2a177f53f --- /dev/null +++ b/site/tests/Training/Dates/TrainingDateFactoryTest.phpt @@ -0,0 +1,73 @@ +dateId = 1; + $row->trainingId = 1; + $row->action = 'action-1'; + $row->name = 'Name'; + $row->price = 2600; + $row->studentDiscount = null; + $row->hasCustomPrice = 0; + $row->hasCustomStudentDiscount = 0; + $row->start = new DateTime('+1 day'); + $row->end = new DateTime('+2 days'); + $row->labelJson = '{"cs_CZ": "lej-bl", "en_US": "la-bel"}'; + $row->public = 1; + $row->status = TrainingDateStatus::Confirmed->value; + $row->remote = 0; + $row->remoteUrl = null; + $row->remoteNotes = null; + $row->venueId = 1; + $row->venueAction = 'venue-1'; + $row->venueHref = 'https://venue.example'; + $row->venueName = 'Venue name'; + $row->venueNameExtended = 'Venue name extended'; + $row->venueAddress = 'Address'; + $row->venueCity = 'City'; + $row->venueDescription = 'Venue **description**'; + $row->cooperationId = 1; + $row->cooperationDescription = 'Co-op'; + $row->videoHref = 'https://video.example'; + $row->feedbackHref = 'https://feedback.example'; + $row->note = 'Not-E'; + $trainingDate = $this->trainingDateFactory->get($row); + Assert::same('Name', $trainingDate->getName()); + Assert::same('lej-bl', $trainingDate->getLabel()); + Assert::same('Not-E', $trainingDate->getNote()); + + $row->labelJson = '{}'; + $trainingDate = $this->trainingDateFactory->get($row); + Assert::null($trainingDate->getLabel()); + + $row->labelJson = '{"cs_CZ": 303}'; + $trainingDate = $this->trainingDateFactory->get($row); + Assert::null($trainingDate->getLabel()); + } + +} + +TestCaseRunner::run(TrainingDateFactoryTest::class); diff --git a/site/tests/Training/Dates/TrainingDatesTest.phpt b/site/tests/Training/Dates/TrainingDatesTest.phpt index 84b160877..cc685568c 100644 --- a/site/tests/Training/Dates/TrainingDatesTest.phpt +++ b/site/tests/Training/Dates/TrainingDatesTest.phpt @@ -36,14 +36,14 @@ class TrainingDatesTest extends TestCase 'name' => 'Action 1', 'price' => 1000, 'studentDiscount' => null, - 'hasCustomPrice' => true, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 1, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-01-05 04:03:02'), 'end' => new DateTime('2020-01-07 04:03:02'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', - 'public' => false, + 'public' => 0, 'status' => 'CONFIRMED', - 'remote' => true, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 1, @@ -67,14 +67,14 @@ class TrainingDatesTest extends TestCase 'name' => 'Action 2', 'price' => 2000, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-02-05 04:03:02'), 'end' => new DateTime('2020-02-07 04:03:02'), 'labelJson' => null, - 'public' => true, + 'public' => 1, 'status' => 'CONFIRMED', - 'remote' => true, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 2, @@ -111,14 +111,14 @@ class TrainingDatesTest extends TestCase 'name' => 'Name', 'price' => 2600, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('+1 day'), 'end' => new DateTime('+2 days'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', - 'public' => true, + 'public' => 1, 'status' => TrainingDateStatus::Confirmed->value, - 'remote' => false, + 'remote' => 0, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 1, @@ -230,14 +230,14 @@ class TrainingDatesTest extends TestCase 'name' => 'Name', 'price' => 2600, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => $start, 'end' => new DateTime('+2 days'), 'labelJson' => null, - 'public' => true, + 'public' => 1, 'status' => $status->value, - 'remote' => true, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => null, diff --git a/site/tests/Training/Dates/UpcomingTrainingDatesTest.phpt b/site/tests/Training/Dates/UpcomingTrainingDatesTest.phpt index 24d655a48..a2c898bdf 100644 --- a/site/tests/Training/Dates/UpcomingTrainingDatesTest.phpt +++ b/site/tests/Training/Dates/UpcomingTrainingDatesTest.phpt @@ -32,14 +32,14 @@ class UpcomingTrainingDatesTest extends TestCase 'name' => 'Action 1', 'price' => 3490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-01-05 04:03:02'), 'end' => new DateTime('2020-01-07 04:03:02'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', 'status' => 'CONFIRMED', - 'public' => false, - 'remote' => true, + 'public' => 0, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 1, @@ -63,14 +63,14 @@ class UpcomingTrainingDatesTest extends TestCase 'name' => 'Action 2', 'price' => 4490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-02-05 04:03:02'), 'end' => new DateTime('2020-02-07 04:03:02'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', 'status' => 'CONFIRMED', - 'public' => true, - 'remote' => true, + 'public' => 1, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 2, @@ -94,14 +94,14 @@ class UpcomingTrainingDatesTest extends TestCase 'name' => 'Action 1', 'price' => 3490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-03-05 04:03:02'), 'end' => new DateTime('2020-03-07 04:03:02'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', 'status' => 'CONFIRMED', - 'public' => true, - 'remote' => true, + 'public' => 1, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 3, @@ -125,14 +125,14 @@ class UpcomingTrainingDatesTest extends TestCase 'name' => 'Action 2', 'price' => 3490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime('2020-04-05 04:03:02'), 'end' => new DateTime('2020-04-07 04:03:02'), 'labelJson' => '{"cs_CZ": "lej-bl", "en_US": "la-bel"}', 'status' => 'CONFIRMED', - 'public' => false, - 'remote' => true, + 'public' => 0, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 4, diff --git a/site/tests/Training/Preliminary/PreliminaryTrainingsTest.phpt b/site/tests/Training/Preliminary/PreliminaryTrainingsTest.phpt index 16f621146..165d75d38 100644 --- a/site/tests/Training/Preliminary/PreliminaryTrainingsTest.phpt +++ b/site/tests/Training/Preliminary/PreliminaryTrainingsTest.phpt @@ -173,14 +173,14 @@ class PreliminaryTrainingsTest extends TestCase 'name' => 'Action 1', 'price' => 3490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime(), 'end' => new DateTime(), 'labelJson' => null, 'status' => 'CONFIRMED', - 'public' => false, - 'remote' => true, + 'public' => 0, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 1, @@ -204,14 +204,14 @@ class PreliminaryTrainingsTest extends TestCase 'name' => 'Action 3', 'price' => 4490, 'studentDiscount' => null, - 'hasCustomPrice' => false, - 'hasCustomStudentDiscount' => false, + 'hasCustomPrice' => 0, + 'hasCustomStudentDiscount' => 0, 'start' => new DateTime(), 'end' => new DateTime(), 'labelJson' => null, 'status' => 'CONFIRMED', - 'public' => true, - 'remote' => true, + 'public' => 1, + 'remote' => 1, 'remoteUrl' => null, 'remoteNotes' => null, 'venueId' => 2,