-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add wpunit tests for
register_graphql_facet_type
(#38)
* fix: registration logic * tests: test base register_graphql_facet_type * test: fix docker plugin install path * fix schema artifact workflow
- Loading branch information
1 parent
d71dd9f
commit 5084ddb
Showing
8 changed files
with
291 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* WPGraphQL test case | ||
* | ||
* For testing WPGraphQL responses. | ||
* | ||
* @since 0.8.0 | ||
* @package Tests\WPGraphQL\TestCase | ||
*/ | ||
|
||
namespace Tests\WPGraphQL\FacetWP\TestCase; | ||
|
||
/** | ||
* Class - GraphQLTestCase | ||
*/ | ||
class FWPGraphQLTestCase extends \Tests\WPGraphQL\TestCase\WPGraphQLTestCase { | ||
public $fwp; | ||
|
||
/** | ||
* Creates users and loads factories. | ||
*/ | ||
public function setUp() : void { | ||
parent::setUp(); | ||
} | ||
|
||
/** | ||
* Post test tear down. | ||
*/ | ||
public function tearDown(): void { | ||
$this->clearFacets(); | ||
// Then... | ||
parent::tearDown(); | ||
} | ||
|
||
public function register_facet( array $config = [] ) : void { | ||
$defaults = [ | ||
'label' => 'Categories', | ||
'name' => 'categories', | ||
'type' => 'checkboxes', | ||
'source' => 'tax/category', | ||
'parent_term' => '', | ||
'hierarchical' => 'no', | ||
'orderby' => 'count', | ||
'count' => '20', | ||
'show_expanded' => 'no', | ||
'ghosts' => 'no', | ||
'preserve_ghosts' => 'no', | ||
'operator' => 'and', | ||
'soft_limit' => '5' | ||
]; | ||
|
||
$config = array_merge( $defaults, $config ); | ||
|
||
FWP()->helper->settings['facets'] = [ $config ]; | ||
} | ||
|
||
public function clearFacets() : void { | ||
FWP()->helper->settings['facets'] = []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.