diff options
Diffstat (limited to 'tests/MetaboxTest.php')
-rw-r--r-- | tests/MetaboxTest.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/MetaboxTest.php b/tests/MetaboxTest.php index d5a27a3..1a1353e 100644 --- a/tests/MetaboxTest.php +++ b/tests/MetaboxTest.php @@ -22,7 +22,7 @@ class MetaboxTest extends TestCase protected function setUp(): void { $this->metabox = new Metabox('Test Metabox'); - $this->field = new MetaboxField('Test Field'); + $this->field = new MetaboxField('test_field'); } /** @@ -62,4 +62,22 @@ class MetaboxTest extends TestCase $this->assertEquals($this->field->parent, $this->metabox->key); $this->assertEquals($this->metabox->fields[$this->field->key], $this->field); } + + /** + * @test + */ + public function addsMultipleFieldsAsArray() + { + $fields = [ + $this->field, + $field2 = (new MetaboxField('field_2')), + ]; + $this->metabox->field($fields); + + $expected = [ + $this->field->key => $this->field, + $field2->key => $field2, + ]; + $this->assertEquals($expected, $this->metabox->fields); + } } |