Skip to content

Commit

Permalink
[homekit-connector][shelly-connector] Refactoring to configuration (#…
Browse files Browse the repository at this point in the history
…172)
  • Loading branch information
actions-user committed Nov 19, 2023
1 parent 0e2a3cb commit 1cf7f10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 5 additions & 1 deletion tests/cases/unit/BaseTestCase.php
Expand Up @@ -12,7 +12,9 @@
use function constant;
use function defined;
use function file_exists;
use function getmypid;
use function md5;
use function strval;
use function time;

abstract class BaseTestCase extends TestCase
Expand Down Expand Up @@ -44,7 +46,9 @@ protected function createContainer(string|null $additionalConfig = null): Nette\
$config->setForceReloadContainer();
$config->setTempDirectory(FB_TEMP_DIR);

$config->addStaticParameters(['container' => ['class' => 'SystemContainer_' . md5((string) time())]]);
$config->addStaticParameters(
['container' => ['class' => 'SystemContainer_' . strval(getmypid()) . md5((string) time())]],
);
$config->addStaticParameters(['appDir' => $rootDir, 'wwwDir' => $rootDir, 'vendorDir' => $vendorDir]);

$config->addConfig(__DIR__ . '/../../common.neon');
Expand Down
16 changes: 9 additions & 7 deletions tools/phpunit-bootstrap.php
Expand Up @@ -2,13 +2,15 @@

// phpcs:ignoreFile

if (!defined('FB_TEMP_DIR')) {
define('FB_TEMP_DIR', __DIR__ . '/../var/tools/PHPUnit/tmp');
}

if (!defined('FB_LOGS_DIR')) {
define('FB_LOGS_DIR', __DIR__ . '/../var/tools/PHPUnit/logs');
}
define('FB_APP_DIR', realpath(__DIR__ . '/..'));
define('FB_CONFIG_DIR', realpath(__DIR__ . '/../config'));
define('FB_VENDOR_DIR', realpath(__DIR__ . '/../vendor'));
is_string(getenv('TEST_TOKEN'))
? define('FB_TEMP_DIR', __DIR__ . '/../var/tools/PHPUnit/tmp/' . getmypid() . '-' . md5((string) time()) . '-' . getenv('TEST_TOKEN') ?? '')
: define('FB_TEMP_DIR', __DIR__ . '/../var/tools/PHPUnit/tmp/' . getmypid() . '-' . md5((string) time()));
is_string(getenv('TEST_TOKEN'))
? define('FB_LOGS_DIR', __DIR__ . '/../var/tools/PHPUnit/logs/' . getmypid() . '-' . md5((string) time()) . '-' . getenv('TEST_TOKEN') ?? '')
: define('FB_LOGS_DIR', __DIR__ . '/../var/tools/PHPUnit/logs/' . getmypid() . '-' . md5((string) time()));

if (@!include __DIR__ . '/../vendor/autoload.php') {
echo 'Install Tester using `composer update --dev`';
Expand Down

0 comments on commit 1cf7f10

Please sign in to comment.