-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathStringyTest.php
More file actions
33 lines (27 loc) · 908 Bytes
/
StringyTest.php
File metadata and controls
33 lines (27 loc) · 908 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;
use Rakit\Validation\Rules\Stringy;
use PHPUnit\Framework\TestCase;
use stdClass;
class StringyTest extends TestCase
{
public function setUp()
{
$this->rule = new Stringy;
}
public function testValids()
{
$this->assertTrue($this->rule->check('foo'));
$this->assertTrue($this->rule->check('123asd'));
$this->assertTrue($this->rule->check('asd123'));
$this->assertTrue($this->rule->check('foo123bar'));
$this->assertTrue($this->rule->check('foo bar'));
$this->assertTrue($this->rule->check('<p><a href="#">Lorem ipsum dolor sit amet</a> cum omnis voluptatum! </p>'));
}
public function testInvalids()
{
$this->assertFalse($this->rule->check(2));
$this->assertFalse($this->rule->check([]));
$this->assertFalse($this->rule->check(new stdClass));
}
}