/** * @dataProvider getRequiredPaths * * @param string $type * @param string $path */ public function testIsPathValid($type, $path) { $this->storage->setType($type); $this->storage->setPath($path); /* @var $context \PHPUnit_Framework_MockObject_MockObject|ExecutionContextInterface */ $context = $this->getMock('\\Symfony\\Component\\Validator\\ExecutionContextInterface'); $context->expects($this->storage->isPathRequired() && !$path ? $this->once() : $this->never())->method('addViolationAt')->with('path', 'Path is required to fill for current type of storage'); $this->storage->isPathValid($context); }