示例#1
0
 public function testSample1SimpleFormat()
 {
     $parser = new \Codelicious\Coda\Parser();
     $result = $parser->parse($this->getSample1(), "simple");
     $this->assertEquals(1, count($result));
     $at = $result[0];
     $this->assertNotEmpty($at->date);
     $this->assertNotEmpty($at->account);
     $this->assertNotEmpty($at->original_balance);
     $this->assertNotEmpty($at->new_balance);
     $this->assertEquals(3, count($at->transactions));
     $tr1 = $at->transactions[0];
     $tr2 = $at->transactions[1];
     $tr3 = $at->transactions[2];
     $this->assertNotEmpty($tr1->account);
     $this->assertNotEmpty($tr1->transaction_date);
     $this->assertNotEmpty($tr1->valuta_date);
     $this->assertNotEmpty($tr1->message);
     $this->assertNotEmpty($tr2->account);
     $this->assertNotEmpty($tr2->transaction_date);
     $this->assertNotEmpty($tr2->valuta_date);
     $this->assertNotEmpty($tr2->structured_message);
     $this->assertNotEmpty($tr3->account);
     $this->assertNotEmpty($tr3->transaction_date);
     $this->assertNotEmpty($tr3->valuta_date);
     $this->assertNotEmpty($tr3->message);
 }
 public function parse($content)
 {
     $parser = new \Codelicious\Coda\Parser();
     $ori_statements = $parser->parse($content, "simple");
     $statements = array();
     if ($ori_statements) {
         foreach ($ori_statements as $stmt) {
             array_push($statements, $this->convert($stmt));
         }
     }
     return $statements;
 }