/** * Assert that defined JSON attributes are returned in the getDirty() * response when expected. */ public function testGetDirtyJson() { // Mock the model with data $mock = new MockJsonDialectModel(); $mock->hintJsonStructure('testColumn', json_encode(['foo' => null])); // At this point 'foo' should not be dirty $this->assertArrayNotHasKey('foo', $mock->getDirty(true)); $mock->setAttribute('testColumn', json_encode(['foo' => 'bar'])); // Now that 'foo' has been changed it should show up in the getDirty() // response $this->assertArrayHasKey('foo', $mock->getDirty(true)); }