Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a2dcb42

Browse files
committedDec 14, 2024·
ISSUE-337: ci
1 parent ff1e96c commit a2dcb42

File tree

6 files changed

+59
-163
lines changed

6 files changed

+59
-163
lines changed
 

‎.github/workflows/ci.yml

+2-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
php-versions: ['7.2', '7.3', '7.4', '8.0']
25+
php-versions: ['8.1']
2626
# dependencies: ['latest', 'oldest']
2727
steps:
2828
- name: Checkout
@@ -50,30 +50,22 @@ jobs:
5050
restore-keys: ${{ runner.os }}-composer-
5151
- name: Install the latest dependencies
5252
run: composer install
53-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
54-
# - name: Install lowest dependencies from
53+
# - name: Install lowest dependencies from
5554
# run: composer update --with-dependencies --prefer-stable --prefer-dist --prefer-lowest
5655
# if: ${{ matrix.dependencies }} == "oldest"
5756
- name: Set up database schema
5857
run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < vendor/phplist/core/resources/Database/Schema.sql
59-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
6058
- name: Validating composer.json
6159
run: composer validate --no-check-all --no-check-lock --strict;
62-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
6360
- name: Linting all php files
6461
run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l;
6562
- name: Running integration tests with phpunit
6663
run: vendor/bin/phpunit tests/Integration/;
67-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
6864
- name: Running the system tests
6965
run: vendor/bin/phpunit tests/System/;
70-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
7166
- name: Running static analysis
7267
run: vendor/bin/phpstan analyse -l 5 src/ tests/;
73-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
7468
- name: Running PHPMD
7569
run: vendor/bin/phpmd src/ text vendor/phplist/core/config/PHPMD/rules.xml;
76-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
7770
- name: Running PHP_CodeSniffer
7871
run: vendor/bin/phpcs --standard=vendor/phplist/core/config/PhpCodeSniffer/ src/ tests/;
79-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
/public/
1414
/var/
1515
/vendor/
16+
.phpunit.result.cache

‎CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1616

1717
### Fixed
1818

19+
## 5.0.0-alpha1
20+
21+
### Changed
22+
- updated to php8.1
23+
1924
## 4.0.0-alpha2
2025

2126
### Added

‎composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
"phplist/core": "dev-ISSUE-337"
3434
},
3535
"require-dev": {
36-
"phpunit/phpunit": "^9.5.2",
37-
"phpunit/phpunit-mock-objects": "^6.1.2",
36+
"phpunit/phpunit": "^9.5",
3837
"guzzlehttp/guzzle": "^7.2.0",
3938
"squizlabs/php_codesniffer": "^3.5.8",
40-
"phpstan/phpstan": " ^0.12.57",
39+
"phpstan/phpstan": "^1.10",
4140
"nette/caching": "^3.1.0",
4241
"nikic/php-parser": "^v4.10.4",
43-
"phpmd/phpmd": "^2.9.1"
42+
"phpmd/phpmd": "^2.9.1",
43+
"symfony/process": "^6.4"
4444
},
4545
"autoload": {
4646
"psr-4": {
+29-107
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace PhpList\WebFrontend\Tests\Integration\Composer;
@@ -12,148 +13,69 @@
1213
*/
1314
class ScriptsTest extends TestCase
1415
{
15-
/**
16-
* @test
17-
*/
18-
public function publicDirectoryHasBeenCreated()
19-
{
20-
static::assertDirectoryExists($this->getAbsolutePublicDirectoryPath());
21-
}
22-
23-
/**
24-
* @return string
25-
*/
26-
private function getAbsolutePublicDirectoryPath(): string
27-
{
28-
return dirname(__DIR__, 3) . '/public/';
29-
}
30-
31-
/**
32-
* @return string[][]
33-
*/
34-
public function publicDirectoryFilesDataProvider(): array
35-
{
36-
return [
37-
'production entry point' => ['app.php'],
38-
'development entry point' => ['app_dev.php'],
39-
'testing entry point' => ['app_test.php'],
40-
'.htaccess' => ['.htaccess'],
41-
];
42-
}
43-
44-
/**
45-
* @test
46-
* @param string $fileName
47-
* @dataProvider publicDirectoryFilesDataProvider
48-
*/
49-
public function publicDirectoryFilesExist(string $fileName)
50-
{
51-
static::assertFileExists($this->getAbsolutePublicDirectoryPath() . $fileName);
52-
}
53-
54-
/**
55-
* @test
56-
*/
57-
public function binariesDirectoryHasBeenCreated()
16+
private function getBundleConfigurationFilePath(): string
5817
{
59-
static::assertDirectoryExists($this->getAbsoluteBinariesDirectoryPath());
18+
return dirname(__DIR__, 3) . '/config/bundles.yml';
6019
}
6120

62-
/**
63-
* @return string
64-
*/
65-
private function getAbsoluteBinariesDirectoryPath(): string
21+
public function testBundleConfigurationFileExists(): void
6622
{
67-
return dirname(__DIR__, 3) . '/bin/';
23+
self::assertFileExists($this->getBundleConfigurationFilePath());
6824
}
6925

70-
/**
71-
* @return string[][]
72-
*/
73-
public function binariesDataProvider(): array
26+
public function bundleClassNameDataProvider(): array
7427
{
7528
return [
76-
'Symfony console' => ['console'],
29+
'Symfony framework bundle' => ['Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'],
30+
'Doctrine bundle' => ['Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle'],
31+
'empty start page bundle' => ['PhpList\\Core\\EmptyStartPageBundle\\EmptyStartPageBundle'],
7732
];
7833
}
7934

8035
/**
81-
* @test
82-
* @param string $fileName
83-
* @dataProvider binariesDataProvider
36+
* @dataProvider bundleClassNameDataProvider
8437
*/
85-
public function binariesExist(string $fileName)
38+
public function testBundleConfigurationFileContainsModuleBundles(string $bundleClassName): void
8639
{
87-
static::assertFileExists($this->getAbsoluteBinariesDirectoryPath() . $fileName);
40+
$fileContents = file_get_contents($this->getBundleConfigurationFilePath());
41+
self::assertStringContainsString($bundleClassName, $fileContents);
8842
}
8943

90-
/**
91-
* @return string
92-
*/
93-
private function getBundleConfigurationFilePath(): string
44+
private function getModuleRoutesConfigurationFilePath(): string
9445
{
95-
return dirname(__DIR__, 3) . '/config/bundles.yml';
46+
return dirname(__DIR__, 3) . '/config/routing_modules.yml';
9647
}
9748

98-
/**
99-
* @test
100-
*/
101-
public function bundleConfigurationFileExists()
49+
public function testModuleRoutesConfigurationFileExists(): void
10250
{
103-
static::assertFileExists($this->getBundleConfigurationFilePath());
51+
self::assertFileExists($this->getModuleRoutesConfigurationFilePath());
10452
}
10553

106-
/**
107-
* @return string[][]
108-
*/
109-
public function bundleClassNameDataProvider(): array
54+
public function moduleRoutingDataProvider(): array
11055
{
11156
return [
112-
'framework bundle' => ['Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'],
57+
'route name' => ['phplist/core.homepage'],
58+
'resource' => ["resource: '@EmptyStartPageBundle/Controller/'"],
59+
'type' => ['type: attribute'],
11360
];
11461
}
11562

11663
/**
117-
* @test
118-
* @param string $bundleClassName
119-
* @dataProvider bundleClassNameDataProvider
120-
*/
121-
public function bundleConfigurationFileContainsModuleBundles(string $bundleClassName)
122-
{
123-
$fileContents = file_get_contents($this->getBundleConfigurationFilePath());
124-
125-
static::assertContains($bundleClassName, $fileContents);
126-
}
127-
128-
/**
129-
* @return string
130-
*/
131-
private function getModuleRoutesConfigurationFilePath(): string
132-
{
133-
return dirname(__DIR__, 3) . '/config/routing_modules.yml';
134-
}
135-
136-
/**
137-
* @test
64+
* @dataProvider moduleRoutingDataProvider
13865
*/
139-
public function moduleRoutesConfigurationFileExists()
66+
public function testModuleRoutesConfigurationFileContainsModuleRoutes(string $routeSearchString): void
14067
{
141-
static::assertFileExists($this->getModuleRoutesConfigurationFilePath());
68+
$fileContents = file_get_contents($this->getModuleRoutesConfigurationFilePath());
69+
self::assertStringContainsString($routeSearchString, $fileContents);
14270
}
14371

144-
/**
145-
* @test
146-
*/
147-
public function parametersConfigurationFileExists()
72+
public function testParametersConfigurationFileExists(): void
14873
{
149-
static::assertFileExists(dirname(__DIR__, 3) . '/config/parameters.yml');
74+
self::assertFileExists(dirname(__DIR__, 3) . '/config/parameters.yml');
15075
}
15176

152-
/**
153-
* @test
154-
*/
155-
public function modulesConfigurationFileExists()
77+
public function testModulesConfigurationFileExists(): void
15678
{
157-
static::assertFileExists(dirname(__DIR__, 3) . '/config/config_modules.yml');
79+
self::assertFileExists(dirname(__DIR__, 3) . '/config/config_modules.yml');
15880
}
15981
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace PhpList\WebFrontend\Tests\System\ApplicationBundle;
@@ -16,57 +17,32 @@ class PhpListApplicationBundleTest extends TestCase
1617
{
1718
use SymfonyServerTrait;
1819

19-
/**
20-
* @var Client
21-
*/
22-
private $httpClient = null;
20+
private ?Client $httpClient = null;
2321

24-
protected function setUp()
22+
protected function setUp(): void
2523
{
24+
parent::setUp();
2625
$this->httpClient = new Client(['http_errors' => false]);
2726
}
2827

29-
protected function tearDown()
28+
protected function tearDown(): void
3029
{
3130
$this->stopSymfonyServer();
31+
$this->httpClient = null;
32+
parent::tearDown();
3233
}
3334

34-
/**
35-
* @return string[][]
36-
*/
37-
public function environmentDataProvider(): array
38-
{
39-
return [
40-
'test' => ['test'],
41-
'dev' => ['dev'],
42-
];
43-
}
44-
45-
/**
46-
* @test
47-
* @param string $environment
48-
* @dataProvider environmentDataProvider
49-
*/
50-
public function homepageReturnsSuccess(string $environment)
35+
public function testHomepageReturnsSuccess(): void
5136
{
52-
$this->startSymfonyServer($environment);
53-
54-
$response = $this->httpClient->get('/', ['base_uri' => $this->getBaseUrl()]);
55-
56-
static::assertSame(200, $response->getStatusCode());
57-
}
58-
59-
/**
60-
* @test
61-
* @param string $environment
62-
* @dataProvider environmentDataProvider
63-
*/
64-
public function homepageReturnsContent(string $environment)
65-
{
66-
$this->startSymfonyServer($environment);
67-
68-
$response = $this->httpClient->get('/', ['base_uri' => $this->getBaseUrl()]);
69-
70-
static::assertNotEmpty($response->getBody()->getContents());
37+
$this->startSymfonyServer();
38+
$response = $this->httpClient->get('/api/v2', [
39+
'base_uri' => $this->getBaseUrl(),
40+
]);
41+
42+
self::assertSame(200, $response->getStatusCode());
43+
self::assertStringContainsString(
44+
'This page has been intentionally left empty.',
45+
$response->getBody()->getContents()
46+
);
7147
}
7248
}

0 commit comments

Comments
 (0)
Please sign in to comment.