From d6fabbd1e2396e9fb68e7cc8a4ea23417cc7d763 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 16 Dec 2020 19:12:18 +0100 Subject: Initial commit --- tests/MetaboxFieldTest.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/MetaboxFieldTest.php (limited to 'tests/MetaboxFieldTest.php') diff --git a/tests/MetaboxFieldTest.php b/tests/MetaboxFieldTest.php new file mode 100644 index 0000000..6d7ede7 --- /dev/null +++ b/tests/MetaboxFieldTest.php @@ -0,0 +1,53 @@ +field = new MetaboxField('test_field'); + } + + /** + * @test + */ + public function hasFieldKeyOnInstantiation() + { + $this->assertEquals('field_test_field', $this->field->key); + } + + /** + * @test + */ + public function hasNamesOnInstantiation() + { + $expectedNames = [ + 'label' => 'Test Field', + 'name' => 'test_field', + ]; + + $this->assertEquals($expectedNames, $this->field->names); + } + + /** + * @test + */ + public function adjustsParentGroupKey() + { + $this->field->parent('metabox_test'); + $this->assertEquals('group_metabox_test', $this->field->parent); + + $this->field->parent('group_metabox_test'); + $this->assertEquals('group_metabox_test', $this->field->parent); + } +} -- cgit v1.2.3