blob: 6d7ede7ff1a93b04c24166e99ef551abee32f3a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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);
}
}
|