Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to php8.1 symfony 6.4 #141

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dad3a20
change branch name
xh3n1 Mar 5, 2019
9e4e996
Disable REST API by default
xh3n1 Mar 6, 2019
7d2145f
Change path
xh3n1 Mar 26, 2019
81fd339
Remove prefix
xh3n1 Apr 4, 2019
30fde0d
[FEATURE] Get the number of subscribers of list and added tests (#116)
xh3n1 May 31, 2019
8fca0ef
[BUGFIX] Fix the expected number in an integration test (#119)
xh3n1 May 31, 2019
4364ded
[CLEANUP] Fix a warning with newer PHPMD versions (#125)
Dec 5, 2019
26ea3c8
update php dependencies
michield Oct 4, 2022
110b25d
update to pass building
michield Feb 9, 2023
c07cee1
ISSUE-337: update package versions
tatevikg1 Nov 24, 2024
b687537
ISSUE-337: use local
tatevikg1 Nov 24, 2024
85ab9ce
ISSUE-337: symfony 6.4
tatevikg1 Nov 30, 2024
f09b1f9
ISSUE-337: test fix
tatevikg1 Dec 5, 2024
bf004d0
ISSUE-337: fix the rest of tests
tatevikg1 Dec 10, 2024
86b26f6
GitHub actions (#132)
nfebe Feb 11, 2021
a35a7d5
ISSUE-337: add pipeline
tatevikg1 Dec 11, 2024
276d397
ISSUE-337: fix phpstan
tatevikg1 Dec 11, 2024
acec73c
ISSUE-337: fix phpstmd
tatevikg1 Dec 11, 2024
3453581
ISSUE-337: openapi docs
tatevikg1 Dec 12, 2024
1986e45
merge main
tatevikg1 Dec 12, 2024
2e8300a
ISSUE-337: move to bundle file
tatevikg1 Dec 12, 2024
b483207
ISSUE-337: changelog
tatevikg1 Dec 14, 2024
884fb1e
ISSUE-337: update core
tatevikg1 Dec 15, 2024
8ad8004
ISSUE-337: fix phpstan
tatevikg1 Dec 15, 2024
7502393
ISSUE-337: fix phpcs
tatevikg1 Dec 15, 2024
1e4294c
ISSUE-337: force push
tatevikg1 Dec 15, 2024
2ce9ae1
ISSUE-337: name fix
tatevikg1 Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ISSUE-337: fix phpstmd
  • Loading branch information
tatevikg1 committed Dec 11, 2024
commit acec73c80fbb3de7574f931e72cebf31322b26cb
2 changes: 2 additions & 0 deletions src/DependencyInjection/PhpListRestExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class PhpListRestExtension extends Extension
*/
public function load(array $configs, ContainerBuilder $container): void
{
// This parameter is unused, but not optional. This line will avoid a static analysis warning this.
$configs;
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('services.yml');
}
Expand Down
12 changes: 8 additions & 4 deletions tests/Integration/Controller/Fixtures/AdministratorFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ public function load(ObjectManager $manager): void

$headers = fgetcsv($handle);

while (($data = fgetcsv($handle)) !== false) {
do {
$data = fgetcsv($handle);
if ($data === false) {
break;
}
$row = array_combine($headers, $data);

$admin = new Administrator();
Expand All @@ -42,9 +46,9 @@ public function load(ObjectManager $manager): void

$manager->persist($admin);

$this->setSubjectProperty($admin,'creationDate', new DateTime($row['created']));
$this->setSubjectProperty($admin,'passwordChangeDate', new DateTime($row['passwordchanged']));
}
$this->setSubjectProperty($admin, 'creationDate', new DateTime($row['created']));
$this->setSubjectProperty($admin, 'passwordChangeDate', new DateTime($row['passwordchanged']));
} while (true);

fclose($handle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,30 @@ public function load(ObjectManager $manager): void
$headers = fgetcsv($handle);
$adminRepository = $manager->getRepository(Administrator::class);

while (($data = fgetcsv($handle)) !== false) {
do {
$data = fgetcsv($handle);
if ($data === false) {
break;
}
$row = array_combine($headers, $data);

$admin = $adminRepository->find($row['adminid']);
if ($admin === null) {
$admin = new Administrator();
$this->setSubjectId($admin,(int)$row['adminid']);
$this->setSubjectId($admin, (int)$row['adminid']);
$admin->setSuperUser(true);
$manager->persist($admin);
}

$adminToken = new AdministratorToken();
$this->setSubjectId($adminToken,(int)$row['id']);
$this->setSubjectId($adminToken, (int)$row['id']);
$adminToken->setKey($row['value']);
$adminToken->setAdministrator($admin);
$manager->persist($adminToken);

$this->setSubjectProperty($adminToken,'expiry', new DateTime($row['expires']));
$this->setSubjectProperty($adminToken, 'expiry', new DateTime($row['expires']));
$this->setSubjectProperty($adminToken, 'creationDate', (bool) $row['entered']);
}
} while (true);

fclose($handle);
}
Expand Down
14 changes: 9 additions & 5 deletions tests/Integration/Controller/Fixtures/SubscriberFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ public function load(ObjectManager $manager): void

$headers = fgetcsv($handle);

while (($data = fgetcsv($handle)) !== false) {
do {
$data = fgetcsv($handle);
if ($data === false) {
break;
}
$row = array_combine($headers, $data);

$subscriber = new Subscriber();
$this->setSubjectId($subscriber,(int)$row['id']);
$this->setSubjectId($subscriber, (int)$row['id']);

$subscriber->setEmail($row['email']);
$subscriber->setConfirmed((bool) $row['confirmed']);
Expand All @@ -46,9 +50,9 @@ public function load(ObjectManager $manager): void
$manager->persist($subscriber);
// avoid pre-persist
$subscriber->setUniqueId($row['uniqid']);
$this->setSubjectProperty($subscriber,'creationDate', new DateTime($row['entered']));
$this->setSubjectProperty($subscriber,'modificationDate', new DateTime($row['modified']));
}
$this->setSubjectProperty($subscriber, 'creationDate', new DateTime($row['entered']));
$this->setSubjectProperty($subscriber, 'modificationDate', new DateTime($row['modified']));
} while (true);

fclose($handle);
}
Expand Down
17 changes: 11 additions & 6 deletions tests/Integration/Controller/Fixtures/SubscriberListFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,24 @@ public function load(ObjectManager $manager): void

$adminRepository = $manager->getRepository(Administrator::class);

while (($data = fgetcsv($handle)) !== false) {
do {
$data = fgetcsv($handle);
if ($data === false) {
break;
}
$row = array_combine($headers, $data);

$admin = $adminRepository->find($row['owner']);
if ($admin === null) {
$admin = new Administrator();
$this->setSubjectId($admin,(int)$row['owner']);
$this->setSubjectId($admin, (int)$row['owner']);
$admin->setSuperUser(true);
$admin->setDisabled(false);
$manager->persist($admin);
}

$subscriberList = new SubscriberList();
$this->setSubjectId($subscriberList,(int)$row['id']);
$this->setSubjectId($subscriberList, (int)$row['id']);
$subscriberList->setName($row['name']);
$subscriberList->setDescription($row['description']);
$subscriberList->setListPosition((int)$row['listorder']);
Expand All @@ -55,9 +60,9 @@ public function load(ObjectManager $manager): void

$manager->persist($subscriberList);

$this->setSubjectProperty($subscriberList,'creationDate', new DateTime($row['entered']));
$this->setSubjectProperty($subscriberList,'modificationDate', new DateTime($row['modified']));
}
$this->setSubjectProperty($subscriberList, 'creationDate', new DateTime($row['entered']));
$this->setSubjectProperty($subscriberList, 'modificationDate', new DateTime($row['modified']));
} while (true);

fclose($handle);
}
Expand Down
12 changes: 8 additions & 4 deletions tests/Integration/Controller/Fixtures/SubscriptionFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ public function load(ObjectManager $manager): void

$headers = fgetcsv($handle);

while (($data = fgetcsv($handle)) !== false) {
do {
$data = fgetcsv($handle);
if ($data === false) {
break;
}
$row = array_combine($headers, $data);

$subscriber = $subscriberRepository->find((int)$row['userid']);
Expand All @@ -47,9 +51,9 @@ public function load(ObjectManager $manager): void

$manager->persist($subscription);

$this->setSubjectProperty($subscription,'creationDate', new DateTime($row['entered']));
$this->setSubjectProperty($subscription,'modificationDate', new DateTime($row['modified']));
}
$this->setSubjectProperty($subscription, 'creationDate', new DateTime($row['entered']));
$this->setSubjectProperty($subscription, 'modificationDate', new DateTime($row['modified']));
} while (true);

fclose($handle);
}
Expand Down
16 changes: 12 additions & 4 deletions tests/Integration/Controller/ListControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ public function testGetListMembersForExistingListWithoutSessionKeyReturnsForbidd

public function testGetListMembersForExistingListWithExpiredSessionKeyReturnsForbiddenStatus()
{
$this->loadFixtures([SubscriberListFixture::class, AdministratorFixture::class, AdministratorTokenFixture::class]);
$this->loadFixtures([
SubscriberListFixture::class,
AdministratorFixture::class,
AdministratorTokenFixture::class,
]);

self::getClient()->request(
'get',
Expand Down Expand Up @@ -269,7 +273,11 @@ public function testGetListSubscribersCountForExistingListWithoutSessionKeyRetur

public function testGetListSubscribersCountForExistingListWithExpiredSessionKeyReturnsForbiddenStatus()
{
$this->loadFixtures([SubscriberListFixture::class, AdministratorFixture::class, AdministratorTokenFixture::class]);
$this->loadFixtures([
SubscriberListFixture::class,
AdministratorFixture::class,
AdministratorTokenFixture::class,
]);

self::getClient()->request(
'get',
Expand All @@ -291,7 +299,7 @@ public function testGetListSubscribersCountWithCurrentSessionKeyForExistingListR
$this->assertHttpOkay();
}

public function testGetListSubscribersCountWithCurrentSessionKeyForExistingListWithNoSubscribersReturnsZero()
public function testGetSubscribersCountForEmptyListWithValidSession()
{
$this->loadFixtures([SubscriberListFixture::class, SubscriberFixture::class, SubscriptionFixture::class]);

Expand All @@ -301,7 +309,7 @@ public function testGetListSubscribersCountWithCurrentSessionKeyForExistingListW
self::assertSame(0, $responseContent);
}

public function testGetListSubscribersCountWithCurrentSessionKeyForExistingListWithSubscribersReturnsSubscribersCount()
public function testGetSubscribersCountForListWithValidSession()
{
$this->loadFixtures([SubscriberListFixture::class, SubscriberFixture::class, SubscriptionFixture::class]);

Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Controller/SessionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testControllerIsAvailableViaContainer()
{
self::assertInstanceOf(
SessionController::class,
self:: getContainer()->get(SessionController::class)
self::getContainer()->get(SessionController::class)
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/System/Controller/SessionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testPostSessionsWithInvalidCredentialsReturnsNotAuthorized()
self::getClient()->request(
'POST',
'/api/v2/sessions',
[],
[],
[],
[],
json_encode($jsonData)
Expand Down
Loading