diff --git a/Tests/Functional/Utility/Lock/MySqlLockTestSecondInstance.php b/Tests/Functional/Utility/Lock/MySqlLockTestSecondInstance.php index ceeabe61..b04d86e3 100755 --- a/Tests/Functional/Utility/Lock/MySqlLockTestSecondInstance.php +++ b/Tests/Functional/Utility/Lock/MySqlLockTestSecondInstance.php @@ -38,16 +38,11 @@ class MySqlLockTestSecondInstance protected $mySQLConnection; - public function __construct() - { - $this->connect(); - } - - protected function connect() + protected function connect($context) { // Load system specific configuration for Apache mode - $dpppConfiguration = __DIR__ . '/../../../../../../configurations/' . GeneralUtility::getApplicationContext() . '/AdditionalConfiguration.php'; + $dpppConfiguration = __DIR__ . '/../../../../../../configurations/' . $context . '/AdditionalConfiguration.php'; if (file_exists($dpppConfiguration)) { @include($dpppConfiguration); @@ -61,13 +56,16 @@ protected function connect() public function test() { - if (!isset($_SERVER['argv']['1']) || !isset($_SERVER['argv']['2'])) { - throw new \Exception('You have to specify the lock identifier and the testType', 1428853716); + if (!isset($_SERVER['argv']['1']) || !isset($_SERVER['argv']['2']) || !isset($_SERVER['argv']['3'])) { + throw new \Exception('You have to specify the context, lock identifier and the testType', 1428853716); } - $lockIdentifier = $_SERVER['argv']['1']; - $testType = $_SERVER['argv']['2']; - $timeout = $_SERVER['argv']['3'] ? $_SERVER['argv']['3'] : 0; + $context = $_SERVER['argv']['1']; + $lockIdentifier = $_SERVER['argv']['2']; + $testType = $_SERVER['argv']['3']; + $timeout = isset($_SERVER['argv']['4']) ? $_SERVER['argv']['4'] : 0; + + $this->connect($context); switch ($testType) { case 'acquireExclusiveLock': diff --git a/Tests/Functional/Utility/Lock/MysqlLockTest.php b/Tests/Functional/Utility/Lock/MysqlLockTest.php index d81e25f9..9c6a7303 100644 --- a/Tests/Functional/Utility/Lock/MysqlLockTest.php +++ b/Tests/Functional/Utility/Lock/MysqlLockTest.php @@ -27,6 +27,7 @@ ***************************************************************/ use PunktDe\PtExtbase\Utility\Lock\Lock; +use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Wget Test Case @@ -46,7 +47,7 @@ class MysqlLockTest extends \PunktDe\PtExtbase\Testing\Unit\AbstractBaseTestcase */ public function setUp() { - $this->mysqlLock = $this->objectManager->get('PunktDe\\PtExtbase\\Utility\\Lock\\Lock', 'lockTest'); + $this->mysqlLock = $this->objectManager->get(\PunktDe\PtExtbase\Utility\Lock\Lock::class, 'lockTest'); } public function tearDown() @@ -62,7 +63,7 @@ public function tearDown() public function acquiringSharedLockThrowsException() { $this->mysqlLock->release(); - $this->objectManager->get('PunktDe\\PtExtbase\\Utility\\Lock\\Lock', 'lockTest', 'PunktDe\\PtExtbase\\Utility\\Lock\\MySqlLockStrategy', false); + $this->objectManager->get(\PunktDe\PtExtbase\Utility\Lock\Lock::class, 'lockTest', \PunktDe\PtExtbase\Utility\Lock\MySqlLockStrategy::class , false); } /** @@ -72,7 +73,7 @@ public function constructAcquiresLock() { $outputArray = []; $returnValue = 0; - exec(__DIR__ . '/MySqlLockTestSecondInstance.php lockTest testIfLockIsFree', $outputArray, $returnValue); + exec(__DIR__ . '/MySqlLockTestSecondInstance.php ' . GeneralUtility::getApplicationContext() . ' lockTest testIfLockIsFree ', $outputArray, $returnValue); $this->assertEquals(0, $returnValue); } @@ -87,7 +88,7 @@ public function afterReleaseLockIsFree() $this->assertTrue($released); - exec(__DIR__ . '/MySqlLockTestSecondInstance.php lockTest testIfLockIsFree', $outputArray, $returnValue); + exec(__DIR__ . '/MySqlLockTestSecondInstance.php ' . GeneralUtility::getApplicationContext() . ' lockTest testIfLockIsFree', $outputArray, $returnValue); $this->assertEquals(1, $returnValue); } @@ -98,7 +99,7 @@ public function acquiringLockASecondTimeIsNotPossible() { $outputArray = []; $returnValue = 0; - exec(__DIR__ . '/MySqlLockTestSecondInstance.php lockTest acquireExclusiveLock', $outputArray, $returnValue); + exec(__DIR__ . '/MySqlLockTestSecondInstance.php ' . GeneralUtility::getApplicationContext() . ' lockTest acquireExclusiveLock', $outputArray, $returnValue); $this->assertEquals(0, $returnValue); } @@ -110,7 +111,7 @@ public function freeingLockIsNotPossibleBySecondClient() { $outputArray = []; $returnValue = 0; - exec(__DIR__ . '/MySqlLockTestSecondInstance.php lockTest freeLock', $outputArray, $returnValue); + exec(__DIR__ . '/MySqlLockTestSecondInstance.php ' . GeneralUtility::getApplicationContext() . ' lockTest freeLock', $outputArray, $returnValue); $this->assertEquals(0, $returnValue); } }