for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tests\FOA\CronBundle\Validator\Constraints;
use FOA\CronBundle\Validator\Constraints\CliCommandPath;
use FOA\CronBundle\Validator\Constraints\CliCommandPathValidator;
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
/**
* @author JM Leroux <[email protected]>
*/
class CliCommandPathValidatorTest extends AbstractConstraintValidatorTest
{
* {@inheritdoc}
protected function createValidator()
return new CliCommandPathValidator('/home/akeneo/pim/app');
}
public function testValidCommand()
$constraint = new CliCommandPath();
$this->validator->validate('php /home/akeneo/pim/app/console debug:container', $constraint);
$this->assertNoViolation();
* @return array
public function getInvalidValues()
return [
['php /home/akeneo/pim/app/hack.php'],
['php /usr/bin/console'],
['/home/akeneo/pim/app/console'],
['php /home/akeneo/pim/app/console_hacked'],
['app/console'],
];
* @dataProvider getInvalidValues
*
* @param string $value
public function testInvalidValues($value)
$this->validator->validate($value, $constraint);
$this->buildViolation($constraint->message)
->setParameter('%string%', $value)
->assertRaised();