From f7add871375ee52acf68c91816b43cbb2df3376c Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Thu, 4 Apr 2024 01:06:58 +0200 Subject: [PATCH] Added testing library --- composer.json | 1 + tests/Integration/TestCase.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/composer.json b/composer.json index c7531f7..a36809d 100644 --- a/composer.json +++ b/composer.json @@ -54,6 +54,7 @@ "wp-launchpad/cli": "^1.0.2", "wp-launchpad/cli-installer": "^0.0.3", "wp-launchpad/core": "^0.2", + "wp-launchpad/phpunit-wp-hooks": "^1.0", "wp-launchpad/take-off": "^1.0.2", "wp-media/phpunit": "^3.0" }, diff --git a/tests/Integration/TestCase.php b/tests/Integration/TestCase.php index 2dc8a05..ca20895 100644 --- a/tests/Integration/TestCase.php +++ b/tests/Integration/TestCase.php @@ -2,10 +2,14 @@ namespace Launchpad\Tests\Integration; use ReflectionObject; +use WPLaunchpadPHPUnitWPHooks\MockHooks; use WPMedia\PHPUnit\Integration\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { + + use MockHooks; + protected $config; protected static $transients = []; @@ -55,4 +59,14 @@ protected function loadTestDataConfig() { $this->config = $this->getTestData( dirname( $filename ), basename( $filename, '.php' ) ); } + + + function getPrefix(): string { + $configs = require LAUNCHPAD_PLUGIN_ROOT . '/configs/parameters.php'; + return $configs['prefix']; + } + + function getCurrentTest(): string { + return $this->getName(); + } }