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