diff options
author | Daniel Weipert <code@drogueronin.de> | 2020-12-17 00:01:06 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2020-12-17 00:01:06 +0100 |
commit | 131e542d013d6c1932bbf477d6eba031cebd0276 (patch) | |
tree | 1eb1026e91453a87dd100b8bc08d55fc92375d9d /tests | |
parent | e3c2639e80665e623e1f1f4ce93fe80babb59f09 (diff) |
Adds function for adding arbitrary locations and rewrites posttype and taxonomy to use this function as wellv1.2.0
Diffstat (limited to 'tests')
-rw-r--r-- | tests/MetaboxTest.php | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/tests/MetaboxTest.php b/tests/MetaboxTest.php index e26c9f2..319e4c0 100644 --- a/tests/MetaboxTest.php +++ b/tests/MetaboxTest.php @@ -36,39 +36,47 @@ class MetaboxTest extends TestCase /** * @test */ - public function assignsPostTypeOnce() + public function assignsPostType() { $this->metabox->posttype(['post', 'page']); - $expectedPostTypes = [ - 'post' => 'post', - 'page' => 'page', + $expectedLocations = [ + [ + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post' + ], + [ + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'page' + ], ]; - $this->assertEquals($expectedPostTypes, $this->metabox->posttypes); - - $this->metabox->posttype('post'); - - $this->assertEquals($expectedPostTypes, $this->metabox->posttypes); + $this->assertEquals($expectedLocations, $this->metabox->locations); } /** * @test */ - public function assignsTaxonomyOnce() + public function assignsTaxonomy() { $this->metabox->taxonomy(['category', 'post_tag']); - $expectedTaxonomies = [ - 'category' => 'category', - 'post_tag' => 'post_tag', + $expectedLocations = [ + [ + 'param' => 'taxonomy', + 'operator' => '==', + 'value' => 'category' + ], + [ + 'param' => 'taxonomy', + 'operator' => '==', + 'value' => 'post_tag' + ], ]; - $this->assertEquals($expectedTaxonomies, $this->metabox->taxonomies); - - $this->metabox->taxonomy('category'); - - $this->assertEquals($expectedTaxonomies, $this->metabox->taxonomies); + $this->assertEquals($expectedLocations, $this->metabox->locations); } /** |