diff options
author | Daniel Weipert <code@drogueronin.de> | 2020-12-16 21:05:39 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2020-12-16 21:05:39 +0100 |
commit | 3195d4785e505f664898b6d5599c844832fa9734 (patch) | |
tree | bf6e32f03fcccec6937812d35d33a971c54f381f /tests/MetaboxTest.php | |
parent | 134f3ac61a191ca1f1c4216057a2af8af274fbc0 (diff) |
Fixes field reference in foreach loopv1.0.2
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); + } } |