Skip to content

Commit

Permalink
Minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
SebKay committed Dec 9, 2021
1 parent bc9bb2e commit 2b1f4e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"dev": "git clean -xffd && composer install --prefer-dist --no-progress",
"prod": "git clean -xffd && composer install --prefer-dist --no-progress --no-dev",
"test": "./vendor/bin/phpunit",
"lint": "./vendor/bin/phpcs ./src --standard=PSR12",
"lint": "./vendor/bin/phpcs ./src --standard=PSR12 --exclude=Generic.Files.LineLength",
"fix": "./vendor/bin/phpcbf ./src --standard=PSR12",
"analyse": "./vendor/bin/psalm",
"analyse-with-info": "@analyse --show-info=true"
Expand Down
20 changes: 10 additions & 10 deletions src/Console/Commands/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ public function __construct()
{
parent::__construct();

$this->appRoot = __DIR__ . '/../../..';
$this->consumerRoot = \exec('pwd');
$this->consumerConfigurationFile = $this->consumerRoot .'/config.touchstone.php';
$this->phpunitExecutablePath = $this->consumerRoot . '/vendor/bin/phpunit';
$this->phpunitConfigPath = $this->appRoot . '/phpunit-touchstone.xml';
$this->appRoot = __DIR__ . '/../../../';
$this->consumerRoot = \exec('pwd') . '/';
$this->consumerConfigurationFile = $this->consumerRoot . 'config.touchstone.php';
$this->phpunitExecutablePath = $this->consumerRoot . 'vendor/bin/phpunit';
$this->phpunitConfigPath = $this->appRoot . 'phpunit-touchstone.xml';
$this->tmpDir = \sys_get_temp_dir();
}

protected function userConfiguration(): UserConfiguration
{
if (!\file_exists($this->consumerConfigurationFile)) {
return [];
return new UserConfiguration();
}

$config = include $this->consumerConfigurationFile;

if (!\is_array($config)) {
return [];
return new UserConfiguration();
}

return new UserConfiguration($config);
Expand All @@ -67,9 +67,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$settings = new TestsSettings();

$settings->testsDir = $this->consumerRoot . '/' . ($this->userConfiguration()->getTestsDirectory() ?: 'tests');
$settings->unitTestsDir = $this->consumerRoot . '/' . ($this->userConfiguration()->getUnitTestsDirectory() ?: 'tests/Unit');
$settings->integrationTestsDir = $this->consumerRoot . '/' . ($this->userConfiguration()->getIntegrationTestsDirectory() ?: 'tests/Integration');
$settings->testsDir = $this->consumerRoot . ($this->userConfiguration()->getTestsDirectory() ?: 'tests');
$settings->unitTestsDir = $this->consumerRoot . ($this->userConfiguration()->getUnitTestsDirectory() ?: 'tests/Unit');
$settings->integrationTestsDir = $this->consumerRoot . ($this->userConfiguration()->getIntegrationTestsDirectory() ?: 'tests/Integration');

try {
$process_args = [
Expand Down
6 changes: 3 additions & 3 deletions src/UserConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ public function __construct(array $configuration = [])
$this->integrationTestDir = $configuration['directories']['integration'] ?? '';
}

public function getTestsDirectory()
public function getTestsDirectory(): string
{
return $this->testDir;
}

public function getUnitTestsDirectory()
public function getUnitTestsDirectory(): string
{
return $this->unitTestDir;
}

public function getIntegrationTestsDirectory()
public function getIntegrationTestsDirectory(): string
{
return $this->integrationTestDir;
}
Expand Down

0 comments on commit 2b1f4e4

Please sign in to comment.