public function testAttributeExist() { $model = new Model(); $model->date = null; //Asserts $this->assertTrue($model->attributeExist('date')); }
public function testGetChanges() { $model = new Model(); $model->client_id = 1; $model->amount = 100; $model->time = time(); $fields_to_remove = array('client_id', 'amount'); $model->removeFields($fields_to_remove); //Assert properties does not exist $this->assertFalse($model->attributeExist('client_id')); $this->assertFalse($model->attributeExist('amount')); }
public function testGetChanges() { $model = new Model(); //Emulate model is filling from DB; $model->fillable(array('name')); $model->setRawAttributes(array('name' => 'Victor'), true); $model->syncOriginal(); $model->exists = true; //Change name $model->name = 'John'; $changes = $model->getChanges(); //Asserts $this->assertInternalType('array', $changes); $this->assertArrayHasKey('field', $changes[0]); $this->assertArrayHasKey('old_value', $changes[0]); $this->assertArrayHasKey('new_value', $changes[0]); }
/** * @expectedException Mookofe\LaravelSupport\Exceptions\AttributeNotFoundException */ public function testGetHumanDateAttrNotFound() { $model = new Model(); //Asserts $model->getHumanDate('date'); }