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
*/
final class UrlTest extends TestCase
{
* @test
* @covers ::filter
public function filter()
$url = 'http://www.example.com';
$this->assertSame($url, Url::filter($url));
}
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage Value '1' is not a string
public function filterNonString()
Url::filter(1);
* @expectedExceptionMessage Value 'www.example.com' is not a valid url
public function filterNotValid()
Url::filter('www.example.com');
public function filterNullPass()
$this->assertSame(null, Url::filter(null, true));
* @expectedExceptionMessage Value failed filtering, $allowNull is set to false
public function filterNullFail()
Url::filter(null);