public function testCreateExpense()
 {
     //simulate form input
     $post = ['oExpense' => ['Name' => 'Test Expense', 'Price' => '100.00', 'CurrencyCode' => 'USD', 'Margin' => '0', 'Cost' => '100.00']];
     $expense = new oExpense();
     $this->assertTrue($expense->load($post), 'Load expense POST data');
     $this->assertTrue($expense->validate(), 'Validate expense');
     $this->assertTrue($expense->save(), 'Create expense');
     return $expense;
 }
예제 #2
0
 public function getExpenses()
 {
     return $this->embeddedMany(oExpense::className(), 'expenses');
 }