Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-11-10 22:35:07 +0300
committerGitHub <noreply@github.com>2020-11-10 22:35:07 +0300
commitc65e3b755443561e2c29f5190dc4918b25203dc9 (patch)
tree2a247fcd972ed1160077eff0cc0356ff1443b5eb /tests
parent3c64683bf85aee739bc7aa18eeefe9dcf4c7896c (diff)
Keep track of last activate/deactivate date for plugins (#16683)
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Integration/Plugin/ManagerTest.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/PHPUnit/Integration/Plugin/ManagerTest.php b/tests/PHPUnit/Integration/Plugin/ManagerTest.php
index 65070e54dd..52c7361bd2 100644
--- a/tests/PHPUnit/Integration/Plugin/ManagerTest.php
+++ b/tests/PHPUnit/Integration/Plugin/ManagerTest.php
@@ -78,13 +78,39 @@ class ManagerTest extends IntegrationTestCase
$this->assertEquals(array(), $this->manager->getLoadedPlugins());
}
- public function test_deactivatePlugin()
+ public function test_activateDeactivatePlugin()
{
+ $plugin = new Plugin('ExampleTheme');
+
+ $this->assertNull($plugin->getPluginLastActivationTime());
+ $this->assertNull($plugin->getPluginLastDeactivationTime());
+
$this->assertFalse($this->manager->isPluginActivated('ExampleTheme'));
$this->manager->activatePlugin('ExampleTheme');
+
+ $lastActivationTime = $plugin->getPluginLastActivationTime();
+ $this->assertNotNull($lastActivationTime);
+
+ $this->assertNull($plugin->getPluginLastDeactivationTime());
+
$this->assertTrue($this->manager->isPluginActivated('ExampleTheme'));
$this->manager->deactivatePlugin('ExampleTheme');
$this->assertFalse($this->manager->isPluginActivated('ExampleTheme'));
+
+ $lastDeactivationTime = $plugin->getPluginLastDeactivationTime();
+ $this->assertNotNull($lastDeactivationTime);
+
+ sleep(1);
+
+ $this->manager->activatePlugin('ExampleTheme');
+
+ $nextLastActivationTime = $plugin->getPluginLastActivationTime();
+ $this->assertGreaterThan($lastActivationTime->getTimestamp(), $nextLastActivationTime->getTimestamp());
+
+ $this->manager->deactivatePlugin('ExampleTheme');
+
+ $nextLastDeactivationTime = $plugin->getPluginLastDeactivationTime();
+ $this->assertGreaterThan($lastDeactivationTime->getTimestamp(), $nextLastDeactivationTime->getTimestamp());
}
/** @see Issue https://github.com/piwik/piwik/issues/8422 */