/** * Include the errors from the given file into the report that we are going * to generate. * * @param SplFileInfo $fileInfo * @param File $file */ public function addErrors(SplFileInfo $fileInfo, File $file) { $this->errors[$fileInfo->getPathname()] = $file->getErrors(); }
/** * @covers ::setCurrentFunction * @covers ::addError * @covers ::getErrors */ public function testAddErrorForFunction() { $file = new File($this->createMockProject(), 'filename', ''); // Add two errors for function 1. $file->setCurrentFunction('function1'); $file->addError('error #1'); $file->addError('error #2'); // None for function 2. $file->setCurrentFunction('function2'); // And one for function 3. $file->setCurrentFunction('function3'); $file->addError('error #3'); $this->assertEquals(array('function1' => array('error #1', 'error #2'), 'function3' => array('error #3')), $file->getErrors()); }