Skip to content

Commit f9ce63b

Browse files
committed
ISSUE-337: test fix
1 parent c323a9c commit f9ce63b

29 files changed

+404
-353
lines changed

composer.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,30 @@
3535
},
3636
"require": {
3737
"php": "^8.1",
38-
"doctrine/orm": "^2.11",
39-
"doctrine/common": "^3.3",
40-
"doctrine/doctrine-bundle": "^2.7",
41-
"symfony/symfony": "^6.4",
4238
"symfony/dependency-injection": "^6.4",
4339
"symfony/config": "^6.4",
4440
"symfony/yaml": "^6.4",
45-
"doctrine/annotations": "*",
46-
"symfony/error-handler": "*",
47-
"symfony/serializer": "*",
41+
"symfony/error-handler": "^6.4",
42+
"symfony/serializer": "^6.4",
4843
"symfony/monolog-bundle": "^3.10",
49-
"symfony/serializer-pack": "^1.3"
44+
"symfony/serializer-pack": "^1.3",
45+
"symfony/orm-pack": "^2.4",
46+
"symfony/asset": "^6.4",
47+
"symfony/security-csrf": "^6.4",
48+
"symfony/form": "^6.4",
49+
"symfony/validator": "^6.4",
50+
"doctrine/doctrine-fixtures-bundle": "^3.7",
51+
"doctrine/instantiator": "^2.0"
5052
},
5153
"require-dev": {
52-
"phpunit/phpunit": "^9.5.2",
54+
"phpunit/phpunit": "^9.5",
5355
"guzzlehttp/guzzle": "^6.3.0",
5456
"squizlabs/php_codesniffer": "^3.2.0",
5557
"phpstan/phpstan": "^0.12.57",
5658
"nette/caching": "^3.0.0",
5759
"nikic/php-parser": "^4.19.1",
5860
"phpmd/phpmd": "^2.6.0",
59-
"doctrine/instantiator": "^1.0.5",
60-
"doctrine/doctrine-fixtures-bundle": "^3.6"
61+
"symfony/test-pack": "^1.1"
6162
},
6263
"suggest": {
6364
"phplist/web-frontend": "5.0.x-dev",

config/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@ framework:
1616
strict_requirements: ~
1717
form: ~
1818
csrf_protection: ~
19-
validation: { enable_annotations: true }
19+
validation:
20+
enable_attributes: true
21+
email_validation_mode: html5
2022
#serializer: { enable_annotations: true }
2123
#templating:
2224
#engines: ['twig']
2325
default_locale: '%locale%'
2426
trusted_hosts: ~
27+
handle_all_throwables: true
2528
session:
2629
# https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
2730
handler_id: session.handler.native_file
2831
save_path: '%kernel.application_dir%/var/sessions/%kernel.environment%'
32+
cookie_secure: auto
33+
cookie_samesite: lax
2934
fragments: ~
3035
http_method_override: true
3136
assets: ~
@@ -59,3 +64,5 @@ doctrine:
5964
type: attribute
6065
dir: '%kernel.project_dir%/src/Domain/Model/'
6166
prefix: 'PhpList\Core\Domain\Model\'
67+
controller_resolver:
68+
auto_mapping: true

config/config_test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ imports:
44
framework:
55
test: ~
66
session:
7-
storage_id: session.storage.mock_file
7+
cookie_domain: session.storage.mock_file
8+
handler_id: null
89
profiler:
910
collect: false
1011

@@ -13,3 +14,7 @@ doctrine:
1314
driver: 'pdo_sqlite'
1415
memory: true
1516
charset: UTF8
17+
# orm:
18+
# entity_managers:
19+
# default:
20+
# report_fields_where_declared: true

config/repositories.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ services:
33
parent: PhpList\Core\Domain\Repository
44
arguments:
55
- PhpList\Core\Domain\Model\Identity\Administrator
6+
- Doctrine\ORM\Mapping\ClassMetadata\ClassMetadata
7+
- PhpList\Core\Security\HashGenerator
68

79
PhpList\Core\Domain\Repository\Identity\AdministratorTokenRepository:
810
parent: PhpList\Core\Domain\Repository

phpdoc.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
<output>docs/phpdocumentor</output>
1010
</paths>
1111

12-
</phpdocumentor>
12+
</phpdocumentor>

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.2/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.5/phpunit.xsd"
66
backupGlobals="false"
77
colors="true"
88
bootstrap="vendor/autoload.php"

public/app_test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
use PhpList\Core\Core\Bootstrap;

src/Domain/Model/Messaging/SubscriberList.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class SubscriberList implements DomainModel, Identity, CreationDate, Modificatio
7878
private ?Administrator $owner = null;
7979

8080
#[ORM\OneToMany(
81-
mappedBy: "subscriberList",
8281
targetEntity: "PhpList\Core\Domain\Model\Subscription\Subscription",
82+
mappedBy: "subscriberList",
8383
cascade: ["remove"]
8484
)]
8585
#[MaxDepth(1)]
@@ -102,6 +102,8 @@ public function __construct()
102102
{
103103
$this->subscriptions = new ArrayCollection();
104104
$this->subscribers = new ArrayCollection();
105+
$this->listPosition = 0;
106+
$this->subjectPrefix = '';
105107
}
106108

107109
public function getName(): string
@@ -126,7 +128,7 @@ public function setDescription(string $description): void
126128

127129
public function getListPosition(): int
128130
{
129-
return $this->listPosition ?? 0;
131+
return $this->listPosition;
130132
}
131133

132134
public function setListPosition(int $listPosition): void
@@ -136,7 +138,7 @@ public function setListPosition(int $listPosition): void
136138

137139
public function getSubjectPrefix(): string
138140
{
139-
return $this->subjectPrefix ?? '';
141+
return $this->subjectPrefix;
140142
}
141143

142144
public function setSubjectPrefix(string $subjectPrefix): void
@@ -156,7 +158,7 @@ public function setPublic(bool $public): void
156158

157159
public function getCategory(): string
158160
{
159-
return $this->category ?? '';
161+
return $this->category;
160162
}
161163

162164
public function setCategory(string $category): void

src/Domain/Model/Subscription/Subscriber.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function __construct()
103103
{
104104
$this->subscriptions = new ArrayCollection();
105105
$this->subscribedLists = new ArrayCollection();
106+
$this->extraData = '';
106107
}
107108

108109
public function isConfirmed(): bool
@@ -188,7 +189,7 @@ public function setDisabled(bool $disabled): void
188189

189190
public function getExtraData(): string
190191
{
191-
return $this->extraData ?? '';
192+
return $this->extraData;
192193
}
193194

194195
public function setExtraData(string $extraData): void

src/Domain/Model/Traits/CreationDateTrait.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace PhpList\Core\Domain\Model\Traits;
66

77
use DateTime;
8-
use Doctrine\ORM\Mapping\PrePersist;
8+
use Doctrine\ORM\Mapping as ORM;
99

1010
/**
1111
* This trait provides an automatic creation date for models.
@@ -37,13 +37,7 @@ private function setCreationDate(DateTime $creationDate): void
3737
$this->creationDate = $creationDate;
3838
}
3939

40-
/**
41-
* Updates the creation date to now.
42-
*
43-
* @PrePersist
44-
*
45-
* @return void
46-
*/
40+
#[ORM\PrePersist]
4741
public function updateCreationDate(): void
4842
{
4943
$this->setCreationDate(new DateTime());

0 commit comments

Comments
 (0)