diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-01-10 00:11:38 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2020-01-10 00:11:38 +0300 |
commit | be5a28b35a8e3dcaeb3ade78fd02ecb2a08cd3d1 (patch) | |
tree | fe19d4b18be3f32580b8712a7dfa49af68e673a2 /tests/PHPUnit | |
parent | 6294606ccacd46b0f4b09a497fe887a70c02b090 (diff) |
Avoid using getmypid (#15364)
* Avoid using getmypid
* use cache for pid
* revert previous change and not use cache
* Added method for getmypid
Diffstat (limited to 'tests/PHPUnit')
-rw-r--r-- | tests/PHPUnit/Integration/ArchiveProcessor/ArchivingStatusTest.php | 2 | ||||
-rw-r--r-- | tests/PHPUnit/Unit/CommonTest.php | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/PHPUnit/Integration/ArchiveProcessor/ArchivingStatusTest.php b/tests/PHPUnit/Integration/ArchiveProcessor/ArchivingStatusTest.php index e7a873ffea..4db7bd10d4 100644 --- a/tests/PHPUnit/Integration/ArchiveProcessor/ArchivingStatusTest.php +++ b/tests/PHPUnit/Integration/ArchiveProcessor/ArchivingStatusTest.php @@ -44,7 +44,7 @@ class ArchivingStatusTest extends IntegrationTestCase $this->assertEquals([ [ - 'key' => 'Archiving.1.fab0afcc3a068ecd91b14d50f3bc911d.' . getmypid(), + 'key' => 'Archiving.1.fab0afcc3a068ecd91b14d50f3bc911d.' . Common::getProcessId(), 'expiry_time' => time() + ArchivingStatus::DEFAULT_ARCHIVING_TTL, ], ], $this->getLockKeysAndTtls()); diff --git a/tests/PHPUnit/Unit/CommonTest.php b/tests/PHPUnit/Unit/CommonTest.php index 90fb4035de..051d67fdb0 100644 --- a/tests/PHPUnit/Unit/CommonTest.php +++ b/tests/PHPUnit/Unit/CommonTest.php @@ -24,6 +24,13 @@ use Piwik\Tests\Framework\Mock\FakeLogger; */ class CommonTest extends PHPUnit_Framework_TestCase { + public function test_getProcessId() + { + $this->assertEquals(getmypid(), Common::getProcessId()); + //assure always returns same value + $this->assertEquals(getmypid(), Common::getProcessId()); + } + /** * Dataprovider for testSanitizeInputValues */ |