forked from corcel/acf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChoicesFieldsTest.php
58 lines (50 loc) · 1.33 KB
/
ChoicesFieldsTest.php
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
54
55
56
57
58
<?php
use Corcel\Acf\Field\Boolean;
use Corcel\Acf\Field\Text;
use Corcel\Model\Post;
/**
* Class ChoicesFieldsTest.
*
* @author Junior Grossi <[email protected]>
*/
class ChoicesFieldsTest extends PHPUnit\Framework\TestCase
{
/**
* @var Post
*/
protected $post;
protected function setUp(): void
{
$this->post = Post::find(44);
}
public function testSelectField()
{
$select = new Text($this->post);
$select->process('fake_select');
$this->assertEquals('red', $select->get());
}
public function testSelectMultipleField()
{
$select = new Text($this->post);
$select->process('fake_select_multiple');
$this->assertEquals(['yellow', 'green'], $select->get());
}
public function testCheckboxField()
{
$check = new Text($this->post);
$check->process('fake_checkbox');
$this->assertEquals(['blue', 'yellow'], $check->get());
}
public function testRadioField()
{
$radio = new Text($this->post);
$radio->process('fake_radio_button');
$this->assertEquals('green', $radio->get());
}
public function testTrueFalseField()
{
$boolean = new Boolean($this->post);
$boolean->process('fake_true_false');
$this->assertTrue($boolean->get());
}
}