From 9566804b2735c205ce2faa7bc27179e54ea4ce5d Mon Sep 17 00:00:00 2001 From: Mauro Cassani Date: Fri, 4 Mar 2022 16:43:33 +0100 Subject: [PATCH] Fixed tests --- src/AbstractFilter.php | 8 ++++++++ tests/MateCatSubFilteringTest.php | 5 ++++- tests/MyMemorySubFilteringTest.php | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/AbstractFilter.php b/src/AbstractFilter.php index 097e0c0..e596976 100644 --- a/src/AbstractFilter.php +++ b/src/AbstractFilter.php @@ -65,6 +65,14 @@ protected function setTarget( $target ) $this->target = $target; } + /** + * Destroy the singleton + */ + public static function destroyInstance() + { + static::$_INSTANCE = null; + } + /** * @param string $source * @param string $target diff --git a/tests/MateCatSubFilteringTest.php b/tests/MateCatSubFilteringTest.php index 64fa040..3b26b5d 100644 --- a/tests/MateCatSubFilteringTest.php +++ b/tests/MateCatSubFilteringTest.php @@ -18,7 +18,10 @@ class MateCatSubFilteringTest extends TestCase * @return \Matecat\SubFiltering\AbstractFilter * @throws \Exception */ - private function getFilterInstance() { + private function getFilterInstance() + { + MateCatFilter::destroyInstance(); // for isolation test + return MateCatFilter::getInstance( new FeatureSet(), 'en-US', 'it-IT' ); } diff --git a/tests/MyMemorySubFilteringTest.php b/tests/MyMemorySubFilteringTest.php index dff531e..e4c839c 100644 --- a/tests/MyMemorySubFilteringTest.php +++ b/tests/MyMemorySubFilteringTest.php @@ -14,6 +14,8 @@ class MyMemorySubFilteringTest extends TestCase */ private function getFilterInstance() { + MyMemoryFilter::destroyInstance(); // for isolation test + return MyMemoryFilter::getInstance(new FeatureSet(), 'en-US','it-IT', []); }