diff --git a/psalm.baseline.xml b/psalm.baseline.xml
index a34e554..1e2ce60 100644
--- a/psalm.baseline.xml
+++ b/psalm.baseline.xml
@@ -3,7 +3,6 @@
array
- array
$command
@@ -44,6 +43,10 @@
+ $composer
+ $composer
+ $mkdir
+ $mkdir
$mkdir
$mkdir
$mkdir
@@ -55,11 +58,19 @@
paths()['shell: PHP']]]>
+ $composer
+ $composer
+ $mkdir
+ $mkdir
$mkdir
$test
paths()['analyze']]]>
+ paths()['composer: install-highest']]]>
+ paths()['composer: install-lowest']]]>
+ paths()['mkdir: phpqa']]]>
+ paths()['mkdir: phpqa']]]>
paths()['mkdir: phpqa']]]>
paths()['prepareAndAnalyze']]]>
paths()['shell: PHP']]]>
@@ -74,6 +85,8 @@
$clean
+ $composer
+ $mkdir
$mkdir
$mkdir
$mkdir
@@ -89,18 +102,23 @@
paths()['permissions: Pimcore']]]>
paths()['prepareAndAnalyze']]]>
paths()['shell: PHP']]]>
+ $touch
$clean
+ $composer
+ $mkdir
$mkdir
$testFunctional
$testUnit
+ $touch
paths()['analyze']]]>
paths()['build: dev']]]>
paths()['build: prod']]]>
paths()['clean: Pimcore application']]]>
+ paths()['composer: install']]]>
paths()['docker compose: start app dev']]]>
paths()['docker compose: start app prod']]]>
paths()['docker compose: start app test']]]>
@@ -108,6 +126,7 @@
paths()['docker compose: stop Pimcore app']]]>
paths()['mkdir: composer']]]>
paths()['mkdir: phpqa']]]>
+ paths()['mkdir: phpqa']]]>
paths()['permissions: Pimcore']]]>
paths()['prepareAndAnalyze']]]>
paths()['setup: Pimcore app test']]]>
@@ -115,6 +134,7 @@
paths()['shell: app']]]>
paths()['test: functional app']]]>
paths()['test: unit']]]>
+ paths()['touch: composer.lock']]]>
@@ -134,7 +154,7 @@
paths()['prepareAndAnalyze']]]>
paths()['setup: Pimcore library test']]]>
paths()['shell: PHP']]]>
- paths()['touch']]]>
+ paths()['touch: .env']]]>
$mkdir
@@ -154,7 +174,7 @@
paths()['shell: app library']]]>
paths()['test: functional library']]]>
paths()['test: unit']]]>
- paths()['touch']]]>
+ paths()['touch: .env']]]>
diff --git a/resources/PHP/common.mk b/resources/PHP/common.mk
index 1d5ec5b..aff5b3b 100644
--- a/resources/PHP/common.mk
+++ b/resources/PHP/common.mk
@@ -19,12 +19,13 @@ sh/php: | ${HOME}/.composer var/phpqa composer.lock ## Run PHP shell
${PHPQA_DOCKER_COMMAND} sh
composer/install: composer.lock
-composer/install-highest: composer.lock
composer.lock: | ${HOME}/.composer var/phpqa
${PHPQA_DOCKER_COMMAND} composer install --audit
touch composer.lock
composer/install-lowest: ${HOME}/.composer var/phpqa
${PHPQA_DOCKER_COMMAND} composer upgrade --prefer-lowest
+composer/install-highest: ${HOME}/.composer var/phpqa
+ ${PHPQA_DOCKER_COMMAND} composer upgrade
composer/validate: | ${HOME}/.composer var/phpqa composer.lock
${PHPQA_DOCKER_COMMAND} composer validate --no-interaction
diff --git a/tests/functional/MakefileTestCase.php b/tests/functional/MakefileTestCase.php
index 4113082..319de89 100644
--- a/tests/functional/MakefileTestCase.php
+++ b/tests/functional/MakefileTestCase.php
@@ -178,7 +178,7 @@ public function generateHelpCommandsExecutionPathFixtures(): array
return $fixtures;
}
- private function getMakefilePath(): string
+ protected function getMakefilePath(): string
{
$path = str_replace([__NAMESPACE__.'\\', '\\'], ['', \DIRECTORY_SEPARATOR], static::class);
$dir = pathinfo($path, \PATHINFO_DIRNAME);
@@ -191,7 +191,7 @@ private function getMakefilePath(): string
return sprintf('resources%2$s%1$s%2$s%3$s.mk', $dir, \DIRECTORY_SEPARATOR, mb_strtolower($name));
}
- private function dryRun(
+ protected function dryRun(
string $makefile,
?string $makeCommand = null,
?array $args = null,
@@ -202,7 +202,7 @@ private function dryRun(
return array_filter(explode("\n", $this->execute($makefile, $makeCommand, $args, $directory)));
}
- private function execute(
+ protected function execute(
string $makefile,
?string $makeCommand = null,
?array $args = null,
diff --git a/tests/functional/PHP/LibraryTest.php b/tests/functional/PHP/LibraryTest.php
index d24b1ae..5729328 100644
--- a/tests/functional/PHP/LibraryTest.php
+++ b/tests/functional/PHP/LibraryTest.php
@@ -26,6 +26,26 @@ final class LibraryTest extends MakefileTestCase
{
use PhpTrait;
+ public function testCanRunComposerInstallLowest(): void
+ {
+ $mkdir = $this->paths()['mkdir: phpqa'];
+ $composer = $this->paths()['composer: install-lowest'];
+ $expected = array_merge($mkdir, $composer);
+ $actual = $this->dryRun($this->getMakefilePath(), 'composer/install-lowest');
+
+ static::assertSame($expected, $actual);
+ }
+
+ public function testCanRunComposerInstallHighest(): void
+ {
+ $mkdir = $this->paths()['mkdir: phpqa'];
+ $composer = $this->paths()['composer: install-highest'];
+ $expected = array_merge($mkdir, $composer);
+ $actual = $this->dryRun($this->getMakefilePath(), 'composer/install-highest');
+
+ static::assertSame($expected, $actual);
+ }
+
protected function getExpectedInitPaths(): array
{
return [
diff --git a/tests/functional/PHP/PhpTrait.php b/tests/functional/PHP/PhpTrait.php
index fad0c0e..1d8cf1e 100644
--- a/tests/functional/PHP/PhpTrait.php
+++ b/tests/functional/PHP/PhpTrait.php
@@ -38,6 +38,16 @@ private function paths(): array
$this->generateDockerBuildxExecutionPath('prod'),
],
+ 'composer: install' => [
+ $this->generatePhpqaExecutionPath('composer install --audit'),
+ ],
+ 'composer: install-lowest' => [
+ $this->generatePhpqaExecutionPath('composer upgrade --prefer-lowest'),
+ ],
+ 'composer: install-highest' => [
+ $this->generatePhpqaExecutionPath('composer upgrade'),
+ ],
+
'docker compose: start app dev' => [
$this->generateDockerComposeAppExecutionPath('up --detach --remove-orphans --no-build', 'dev'),
],
@@ -115,9 +125,12 @@ private function paths(): array
'mkdir -p $HOME/.composer',
'mkdir -p var/phpqa',
],
- 'touch' => [
+ 'touch: .env' => [
'touch .env',
],
+ 'touch: composer.lock' => [
+ 'touch composer.lock',
+ ],
'clean: Pimcore application' => [
'rm -rf var/admin/* var/cache/* var/log/* var/tmp/*',
],
diff --git a/tests/functional/Pimcore/ApplicationTest.php b/tests/functional/Pimcore/ApplicationTest.php
index 8af38ce..1a63a83 100644
--- a/tests/functional/Pimcore/ApplicationTest.php
+++ b/tests/functional/Pimcore/ApplicationTest.php
@@ -28,6 +28,23 @@ final class ApplicationTest extends MakefileTestCase
{
use PhpTrait;
+ public function testCanRunComposerInstall(): void
+ {
+ $filesystem = new Filesystem();
+ $filesystem->rename('composer.lock', 'composer.lock.old');
+
+ $mkdir = $this->paths()['mkdir: phpqa'];
+ $composer = $this->paths()['composer: install'];
+ $touch = $this->paths()['touch: composer.lock'];
+ $expected = array_merge($mkdir, $composer, $touch);
+
+ $actual = $this->dryRun($this->getMakefilePath(), 'composer/install');
+
+ $filesystem->rename('composer.lock.old', 'composer.lock');
+
+ static::assertSame($expected, $actual);
+ }
+
protected function setUp(): void
{
$filesystem = new Filesystem();
diff --git a/tests/functional/Pimcore/LibraryTest.php b/tests/functional/Pimcore/LibraryTest.php
index bbc310f..b50b262 100644
--- a/tests/functional/Pimcore/LibraryTest.php
+++ b/tests/functional/Pimcore/LibraryTest.php
@@ -53,7 +53,7 @@ protected function getExpectedHelpCommandsExecutionPath(): array
'analyze' => array_merge($mkdir, $this->paths()['analyze']),
'clean' => $this->paths()['clean: library'],
'dist' => array_merge($mkdir, $this->paths()['prepareAndAnalyze'], $testUnit, $testFunctional),
- 'setup/test' => array_merge($this->paths()['docker compose: start library test'], $this->paths()['touch'], $this->paths()['setup: Pimcore library test']),
+ 'setup/test' => array_merge($this->paths()['docker compose: start library test'], $this->paths()['touch: .env'], $this->paths()['setup: Pimcore library test']),
'sh/app' => $this->paths()['shell: app library'],
'sh/php' => array_merge($mkdir, $this->paths()['shell: PHP']),
'start/test' => $this->paths()['docker compose: start library test'],