summaryrefslogtreecommitdiff
path: root/tests/MetaboxFieldTest.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2020-12-16 19:12:18 +0100
committerDaniel Weipert <code@drogueronin.de>2020-12-16 19:12:18 +0100
commitd6fabbd1e2396e9fb68e7cc8a4ea23417cc7d763 (patch)
tree975d883c853461c2102465ace8cb64938237878f /tests/MetaboxFieldTest.php
Initial commitv1.0.0
Diffstat (limited to 'tests/MetaboxFieldTest.php')
-rw-r--r--tests/MetaboxFieldTest.php53
1 files changed, 53 insertions, 0 deletions
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 @@
+<?php
+
+use PHPUnit\Framework\TestCase;
+use PostTypes\MetaboxField;
+
+class MetaboxFieldTest extends TestCase
+{
+ /**
+ * @var MetaboxField
+ */
+ public $field;
+
+ /**
+ * @inheritDoc
+ */
+ protected function setUp(): void
+ {
+ $this->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);
+ }
+}