Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates tests for PHPUnit 8.5 #122

Merged
merged 1 commit into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/Framework/TestCase/IntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IntegrationTestCase extends \Piwik\Tests\Framework\TestCase\IntegrationTes
{
protected $testRequiresRedis = true;

public function setUp()
public function setUp(): void
{
if ($this->testRequiresRedis && !self::isRedisAvailable()) {
$this->markTestSkipped('Redis extension is not installed, skipping test');
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Queue/Backend/MysqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MysqlTest extends IntegrationTestCase
private $listKey = 'testMyListTestKey';
private $key = 'testKeyValueKey';

public function setUp()
public function setUp(): void
{
if (!$this->hasDependencies()) {
parent::setUp();
Expand All @@ -50,7 +50,7 @@ public function setUp()
}
}

public function tearDown()
public function tearDown(): void
{
$GLOBALS['PIWIK_TRACKER_MODE'] = false;
Db::destroyDatabaseObject();
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Queue/Backend/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RedisTest extends IntegrationTestCase
private $listKey = 'testMyListTestKey';
private $key = 'testKeyValueKey';

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
11 changes: 5 additions & 6 deletions tests/Integration/Queue/Backend/SentinelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
*/
class SentinelTest extends RedisTest
{
public function setUp()
public function setUp(): void
{
if (self::isTravisCI()) {
$this->markTestSkipped('Sentinel is not installed on travis');
}
parent::setUp();
}

public function tearDown()
public function tearDown(): void
{
Config::getInstance()->QueuedTracking = array();
parent::tearDown();
Expand Down Expand Up @@ -64,12 +64,11 @@ public function test_canCreateInstanceWithMultipleSentinelAndFallback()
$this->assertTrue($sentinel->testConnection());
}

/**
* @expectedException \Exception
* @expectedExceptionMessage QueuedTracking_NumHostsNotMatchNumPorts
*/
public function test_connect_ShouldThrowException_IfNotExactSameHostAndPortNumbersGiven()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage('QueuedTracking_NumHostsNotMatchNumPorts');

$this->enableRedisSentinel();

$settings = Factory::getSettings();
Expand Down
7 changes: 3 additions & 4 deletions tests/Integration/Queue/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ public function test_makeBackend_shouldReturnARedisInstance()
$this->assertFalse($backend instanceof Queue\Backend\Sentinel);
}

/**
* @expectedException \Exception
* @expectedExceptionMessage You must configure a sentinel master name
*/
public function test_makeBackend_shouldFailToCreateASentinelInstance_IfNotFullyConfigured()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage('You must configure a sentinel master name');

Config::getInstance()->QueuedTracking = array('useSentinelBackend' => '1', 'sentinelMasterName' => '');
Factory::makeBackend();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Queue/LockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class LockTest extends IntegrationTestCase
*/
public $lock;

public function setUp()
public function setUp(): void
{
parent::setUp();

$redis = $this->createMySQLBackend();
$this->lock = $this->createLock($redis);
}

public function tearDown()
public function tearDown(): void
{
$this->clearBackend();
parent::tearDown();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Queue/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ManagerTest extends IntegrationTestCase
*/
private $lock;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -64,7 +64,7 @@ private function createQueueManager()
return array('queue' => $queue, 'lock' => $lock);
}

public function tearDown()
public function tearDown(): void
{
$this->clearBackend();
parent::tearDown();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Queue/Processor/HandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HandlerTest extends IntegrationTestCase
*/
private $tracker;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -54,7 +54,7 @@ public function setUp()
$this->handler->init($this->tracker);
}

public function tearDown()
public function tearDown(): void
{
$this->handler->rollBack($this->tracker);

Expand Down
11 changes: 5 additions & 6 deletions tests/Integration/Queue/ProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ProcessorTest extends IntegrationTestCase
*/
private $lock;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -72,7 +72,7 @@ public function setUp()
$this->processor = $this->createProcessor();
}

public function tearDown()
public function tearDown(): void
{
$this->clearBackend();
parent::tearDown();
Expand Down Expand Up @@ -155,12 +155,11 @@ public function test_process_shouldProcessEachBulkRequestsWithinRequest()
$this->assertNumberOfRequestSetsLeftInQueue(2);
}

/**
* @expectedException \Piwik\Plugins\QueuedTracking\Queue\LockExpiredException
* @expectedExceptionMessage Rolled back
*/
public function test_processRequestSets_ShouldThrowAnExceptionAndRollback_InCaseWeDoNoLongerHaveTheLock()
{
$this->expectException(\Piwik\Plugins\QueuedTracking\Queue\LockExpiredException::class);
$this->expectExceptionMessage('Rolled back');

$queuedRequestSets = array(
$this->buildRequestSet(5)
);
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/QueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class QueueTest extends IntegrationTestCase
*/
private $queue;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -44,7 +44,7 @@ private function createQueue($id)
return $queue;
}

public function tearDown()
public function tearDown(): void
{
$this->clearBackend();
parent::tearDown();
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/QueuedTrackingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class QueuedTrackingTest extends IntegrationTestCase
*/
private $plugin;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->plugin = new QueuedTracking();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Settings/NumWorkersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class NumWorkersTest extends IntegrationTestCase
*/
private $settings;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->clearBackend();
Expand All @@ -35,7 +35,7 @@ public function setUp()
$this->settings = $container->get('Piwik\Plugins\QueuedTracking\SystemSettings');
}

public function tearDown()
public function tearDown(): void
{
$this->clearBackend();
parent::tearDown();
Expand Down
Loading