Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Pagekit\Filter\Tests; use Pagekit\Filter\PregReplaceFilter; class PregR..
Decoded Output download
<?php
namespace Pagekit\Filter\Tests;
use Pagekit\Filter\PregReplaceFilter;
class PregReplaceTest extends \PHPUnit_Framework_TestCase
{
/**
* @var PregReplace
**/
protected $filter;
public function setUp()
{
$this->filter = new PregReplaceFilter;
}
/**
* @expectedException \RuntimeException
*/
public function testRuntimeException()
{
$this->filter->filter('foo');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testModifierE()
{
$this->filter->setPattern('/foo/e');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPatternArgument()
{
$this->filter->setPattern(null);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testReplacementArgument()
{
$this->filter->setReplacement(null);
}
/**
* @dataProvider provider
*/
public function testFilter($pattern, $replacement, $in, $out)
{
$this->filter->setPattern($pattern);
$this->assertSame($this->filter->getPattern(), $pattern);
$this->filter->setReplacement($replacement);
$this->assertSame($this->filter->getReplacement(), $replacement);
$this->assertSame($this->filter->filter($in), $out);
}
public function provider()
{
return [
['/foo/i', '', 'Foobar', 'bar'],
[['/foo/', '/bar/'], ['FOO', 'BAR'], 'foobar', 'FOOBAR']
];
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Pagekit\Filter\Tests;
use Pagekit\Filter\PregReplaceFilter;
class PregReplaceTest extends \PHPUnit_Framework_TestCase
{
/**
* @var PregReplace
**/
protected $filter;
public function setUp()
{
$this->filter = new PregReplaceFilter;
}
/**
* @expectedException \RuntimeException
*/
public function testRuntimeException()
{
$this->filter->filter('foo');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testModifierE()
{
$this->filter->setPattern('/foo/e');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPatternArgument()
{
$this->filter->setPattern(null);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testReplacementArgument()
{
$this->filter->setReplacement(null);
}
/**
* @dataProvider provider
*/
public function testFilter($pattern, $replacement, $in, $out)
{
$this->filter->setPattern($pattern);
$this->assertSame($this->filter->getPattern(), $pattern);
$this->filter->setReplacement($replacement);
$this->assertSame($this->filter->getReplacement(), $replacement);
$this->assertSame($this->filter->filter($in), $out);
}
public function provider()
{
return [
['/foo/i', '', 'Foobar', 'bar'],
[['/foo/', '/bar/'], ['FOO', 'BAR'], 'foobar', 'FOOBAR']
];
}
}
Function Calls
None |
Stats
MD5 | 7f905c1bd02cf4a32a4d2e77ff390bea |
Eval Count | 0 |
Decode Time | 112 ms |