for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use ivol\Config\ConfigurationFactory;
use ivol\ExecParams;
class ExecParamsTest extends PHPUnit_Framework_TestCase
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
/** @var ExecParams */
private $sut;
protected function setUp()
$this->sut = new ExecParams('echo ? %s', array("'123"));
}
public function testGetParamsReturnsEscapedParamsByDefault()
$this->assertEquals(["''\''123'"], $this->sut->getParams());
public function testGetParamsReturnsNotEscapedParamsIfConfigured()
$this->sut->setConfig(['escape_shell_args' => false]);
$this->assertEquals(["'123"], $this->sut->getParams());
public function testGetFullCommandReturnsEscapedCommandByDefault()
$this->assertEquals("echo \? ''\\\\''123\'", $this->sut->getFullCommand());
public function testGetFullCommandReturnsNotEscapedCommandIfConfigured()
$this->sut->setConfig(ConfigurationFactory::createFromArray(['escape_shell_cmd' => false]));
$this->assertEquals("echo ? ''\''123'", $this->sut->getFullCommand());
public function testGetFullCommandReturnsNotEscapedCommandAndArgsIfConfigured()
$this->sut->setConfig(ConfigurationFactory::createFromArray(['escape_shell_cmd' => false, 'escape_shell_args' => false]));
$this->assertEquals("echo ? '123", $this->sut->getFullCommand());
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.