From f9898d4084292ad424317bfb5e2465a11c5682f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20G=C3=BCnter?= Date: Tue, 5 May 2020 19:20:17 +0200 Subject: [PATCH] fix: install database tables after reactivate plugin (#52k7f1) --- packages/utils/src/Core.php | 1 + packages/utils/test/phpunit/CoreTest.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/utils/src/Core.php b/packages/utils/src/Core.php index 37623b8..ae4978e 100755 --- a/packages/utils/src/Core.php +++ b/packages/utils/src/Core.php @@ -60,6 +60,7 @@ protected function construct() { dirname(__DIR__) )->hooks(); + register_activation_hook($pluginFile, [$this->getActivator(), 'install']); register_activation_hook($pluginFile, [$this->getActivator(), 'activate']); register_deactivation_hook($pluginFile, [$this->getActivator(), 'deactivate']); } diff --git a/packages/utils/test/phpunit/CoreTest.php b/packages/utils/test/phpunit/CoreTest.php index de50177..6a03b02 100755 --- a/packages/utils/test/phpunit/CoreTest.php +++ b/packages/utils/test/phpunit/CoreTest.php @@ -93,6 +93,10 @@ public function testConstruct() { 'times' => 1, 'args' => [PHPUNIT_FILE, [$mockActivator, 'activate']] ]); + WP_Mock::userFunction('register_activation_hook', [ + 'times' => 1, + 'args' => [PHPUNIT_FILE, [$mockActivator, 'install']] + ]); WP_Mock::userFunction('register_deactivation_hook', [ 'times' => 1, 'args' => [PHPUNIT_FILE, [$mockActivator, 'deactivate']]