/** * Map Invoices with Payments * * @param \ArrayObject $invoices Invoices to check * @param string $pathToSource Absolute path source, that contains payments * @param string $parserName Name of the parser to use while parsing file (see ParserFactory class) * * @return \ArrayObject Payments that had matching invoices * @throws \Exception When mapping fails, exception is thrown */ public function map(\ArrayObject $invoices, $pathToSource, $parserName) { $this->_extractor->extractPayments($pathToSource, $parserName); $payments = $this->_extractor->getPayments(); $results = $this->_comparator->compare($invoices, $payments); return $results; }
/** * @expectedException \Exception */ public function testShouldThrowExceptionOnInvalidTypes() { $invalidItem = new stdClass(); $invalidItem->invoiceNo = 'A1234'; $invoices = new \ArrayObject(array($invalidItem)); $payments = new \ArrayObject(array($invalidItem)); $this->comparator->compare($invoices, $payments); $this->fail('Should have thrown an exception!'); }