/** * Test determination of dirty/changed attributes. * * @group laravel */ public function testDeterminationOfChangedAttributes() { $array = array('name' => 'Taylor', 'age' => 25, 'foo' => null); $model = new Model($array, true); $model->name = 'Otwell'; $model->new = null; $this->assertTrue($model->changed('name')); $this->assertFalse($model->changed('age')); $this->assertFalse($model->changed('foo')); $this->assertFalse($model->changed('new')); $this->assertTrue($model->dirty()); $this->assertEquals(array('name' => 'Otwell', 'new' => null), $model->get_dirty()); $model->sync(); $this->assertFalse($model->changed('name')); $this->assertFalse($model->changed('age')); $this->assertFalse($model->changed('foo')); $this->assertFalse($model->changed('new')); $this->assertFalse($model->dirty()); $this->assertEquals(array(), $model->get_dirty()); }