/** * @param string $fixture * @param int $errors */ private function validateFixture($fixture, $errors) { $result = $this->linter->lint($this->getFixture($fixture)); $this->assertInstanceOf('GrumPHP\\Collection\\LintErrorsCollection', $result); $this->assertEquals($result->count(), $errors, 'Invalid error-count expected.'); if ($result->count()) { $this->assertInstanceOf('GrumPHP\\Linter\\Xml\\XmlLintError', $result[0]); } }
function it_throws_exception_if_the_process_fails(XmlLinter $linter, ContextInterface $context) { $linter->isInstalled()->willReturn(true); $linter->setLoadFromNet(false)->shouldBeCalled(); $linter->setXInclude(false)->shouldBeCalled(); $linter->setDtdValidation(false)->shouldBeCalled(); $linter->setSchemeValidation(false)->shouldBeCalled(); $linter->lint(Argument::type('SplFileInfo'))->willReturn(new LintErrorsCollection(array(new XmlLintError(LintError::TYPE_ERROR, 0, 'error', 'file.xml', 1, 1)))); $context->getFiles()->willReturn(new FilesCollection(array(new SplFileInfo('file.xml', '.', 'file.xml')))); $this->shouldThrow('GrumPHP\\Exception\\RuntimeException')->duringRun($context); }
function it_throws_exception_if_the_process_fails(XmlLinter $linter, ContextInterface $context) { $linter->isInstalled()->willReturn(true); $linter->setLoadFromNet(false)->shouldBeCalled(); $linter->setXInclude(false)->shouldBeCalled(); $linter->setDtdValidation(false)->shouldBeCalled(); $linter->setSchemeValidation(false)->shouldBeCalled(); $linter->lint(Argument::type('SplFileInfo'))->willReturn(new LintErrorsCollection([new XmlLintError(LintError::TYPE_ERROR, 0, 'error', 'file.xml', 1, 1)])); $context->getFiles()->willReturn(new FilesCollection([new SplFileInfo('file.xml', '.', 'file.xml')])); $result = $this->run($context); $result->shouldBeAnInstanceOf(TaskResultInterface::class); $result->isPassed()->shouldBe(false); }