diff --git a/includes/class-helpers.php b/includes/class-helpers.php index e43cc15..c9db677 100644 --- a/includes/class-helpers.php +++ b/includes/class-helpers.php @@ -37,7 +37,8 @@ final class Helpers $resolved = null; if ($first_segment !== null) { - $terms = \get_terms('town', [ + $terms = \get_terms([ + 'taxonomy' => 'town', 'hide_empty' => false, 'fields' => 'id=>slug', ]); diff --git a/tests/HelpersTest.php b/tests/HelpersTest.php index 78f3f07..4af6e74 100644 --- a/tests/HelpersTest.php +++ b/tests/HelpersTest.php @@ -57,8 +57,9 @@ final class HelpersTest extends TestCase \Brain\Monkey\Functions\expect('get_terms') ->once() - ->with('town', \Mockery::on(function ($args) { - return ($args['hide_empty'] ?? null) === false + ->with(\Mockery::on(function ($args) { + return ($args['taxonomy'] ?? null) === 'town' + && ($args['hide_empty'] ?? null) === false && ($args['fields'] ?? null) === 'id=>slug'; })) ->andReturn([10 => 'spb', 11 => 'tyumen']); diff --git a/tests/TestCase.php b/tests/TestCase.php index 27b871a..19c2376 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -24,6 +24,7 @@ abstract class TestCase extends BaseTestCase protected function tearDown(): void { + unset($_SERVER['REQUEST_URI']); Monkey\tearDown(); parent::tearDown(); }