lint() public method

public lint ( SplFileInfo $file ) : mixed
$file SplFileInfo
return mixed
Ejemplo n.º 1
0
 /**
  * @param string $fixture
  * @param int $errors
  */
 private function validateFixture($fixture, $errors)
 {
     $result = $this->linter->lint($this->getFixture($fixture));
     $this->assertInstanceOf(LintErrorsCollection::class, $result);
     $this->assertEquals($result->count(), $errors, 'Invalid error-count expected.');
     if ($result->count()) {
         $this->assertInstanceOf(JsonLintError::class, $result[0]);
     }
 }
Ejemplo n.º 2
0
 function it_throws_exception_if_the_process_fails(JsonLinter $linter, ContextInterface $context)
 {
     $linter->isInstalled()->willReturn(true);
     $linter->setDetectKeyConflicts(false)->shouldBeCalled();
     $linter->lint(Argument::type('SplFileInfo'))->willReturn(new LintErrorsCollection(array(new JsonLintError(LintError::TYPE_ERROR, 0, 'error', 'file.json', 1, 1))));
     $context->getFiles()->willReturn(new FilesCollection(array(new SplFileInfo('file.json', '.', 'file.json'))));
     $this->shouldThrow('GrumPHP\\Exception\\RuntimeException')->duringRun($context);
 }
Ejemplo n.º 3
0
 function it_throws_exception_if_the_process_fails(JsonLinter $linter, ContextInterface $context)
 {
     $linter->isInstalled()->willReturn(true);
     $linter->setDetectKeyConflicts(false)->shouldBeCalled();
     $linter->lint(Argument::type('SplFileInfo'))->willReturn(new LintErrorsCollection([new JsonLintError(LintError::TYPE_ERROR, 0, 'error', 'file.json', 1, 1)]));
     $context->getFiles()->willReturn(new FilesCollection([new SplFileInfo('file.json', '.', 'file.json')]));
     $result = $this->run($context);
     $result->shouldBeAnInstanceOf(TaskResultInterface::class);
     $result->isPassed()->shouldBe(false);
 }