-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
CheckboxTest.php
47 lines (36 loc) · 1.11 KB
/
CheckboxTest.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
<?php
namespace Notion\Test\Unit\Pages\Properties;
use Notion\Pages\Properties\Checkbox;
use Notion\Pages\Properties\Factory;
use PHPUnit\Framework\TestCase;
class CheckboxTest extends TestCase
{
public function test_create(): void
{
$checkbox = Checkbox::create(true);
$this->assertTrue($checkbox->property()->isCheckbox());
$this->assertTrue($checkbox->isChecked());
}
public function test_check(): void
{
$checkbox = Checkbox::create()->check();
$this->assertTrue($checkbox->isChecked());
}
public function test_uncheck(): void
{
$checkbox = Checkbox::create(true)->uncheck();
$this->assertFalse($checkbox->isChecked());
}
public function test_array_conversion(): void
{
$array = [
"id" => "abc",
"type" => "checkbox",
"checkbox" => true,
];
$checkbox = Checkbox::fromArray($array);
$fromFactory = Factory::fromArray($array);
$this->assertEquals($array, $checkbox->toArray());
$this->assertEquals($array, $fromFactory->toArray());
}
}