-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathAcceptedTest.php
More file actions
33 lines (27 loc) · 859 Bytes
/
AcceptedTest.php
File metadata and controls
33 lines (27 loc) · 859 Bytes
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
<?php
namespace Rakit\Validation\Tests\Rules;
use Rakit\Validation\Rules\Accepted;
use PHPUnit\Framework\TestCase;
class AcceptedTest extends TestCase
{
public function setUp()
{
$this->rule = new Accepted;
}
public function testValids()
{
$this->assertTrue($this->rule->check('yes'));
$this->assertTrue($this->rule->check('on'));
$this->assertTrue($this->rule->check('1'));
$this->assertTrue($this->rule->check(1));
$this->assertTrue($this->rule->check(true));
$this->assertTrue($this->rule->check('true'));
}
public function testInvalids()
{
$this->assertFalse($this->rule->check(''));
$this->assertFalse($this->rule->check('onn'));
$this->assertFalse($this->rule->check(' 1'));
$this->assertFalse($this->rule->check(10));
}
}