Skip to content

Commit

Permalink
add more tests for filter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 23, 2019
1 parent 2f42c17 commit ff378a3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/Filter/FiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ public function testString()
self::assertSame('tom', Filters::string('tom'));
self::assertSame('tom', Filters::stripped('tom'));
self::assertSame('abc&', Filters::string('abc&'));
self::assertSame(['abc&', '1'], Filters::string(['abc&', 1]));

// quotes
self::assertSame("O\'Reilly?", Filters::quotes("O'Reilly?"));

// email
self::assertSame('', Filters::email([]));

// url
self::assertSame('', Filters::url([]));
self::assertSame('abc/hi', Filters::url('abc/hi'));

// unsafeRaw
self::assertSame('abc/hi', Filters::unsafeRaw('abc/hi'));
}

public function testNl2br()
Expand Down Expand Up @@ -171,6 +185,7 @@ public function testStr2list()

public function testUnique()
{
$this->assertSame([1], Filters::unique(1));
$this->assertSame([1], Filters::unique([1, 1]));
$this->assertSame(['a', 'b'], Filters::unique(['a', 'b', 'a']));
$this->assertSame(['a', 2 => 'b'], Filters::unique(['a', 'a', 'b', 'a']));
Expand Down

0 comments on commit ff378a3

Please sign in to comment.