for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace TraderInteractive\Filter;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass \TraderInteractive\Filter\Url
* @covers ::<private>
*/
final class UrlTest extends TestCase
{
* @test
* @covers ::filter
public function filter()
$url = 'http://www.example.com';
$this->assertSame($url, Url::filter($url));
}
public function filterNonString()
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage("Value '1' is not a string");
Url::filter(1);
public function filterNotValid()
$this->expectExceptionMessage("Value 'www.example.com' is not a valid url");
Url::filter('www.example.com');
public function filterNullPass()
$this->assertSame(null, Url::filter(null, true));
public function filterNullFail()
$this->expectExceptionMessage('Value failed filtering, $allowNull is set to false');
Url::filter(null);