/** * Assert that JSON attributes can be set through mutators */ public function testSetAttribute() { // Mock the model with data $mock = new MockJsonDialectModel(); $mock->setJsonColumns(['testColumn']); $mock->setAttribute('testColumn', json_encode(['foo' => 'bar'])); // Execute the insepect call $mock->inspectJsonColumns(); $mock->foo = 'baz'; $mock->setJsonAttribute('testColumn', 'fizz', 'buzz'); // Assert that the column were properly parsed and various bits have // been set on the model $this->assertEquals($mock->foo, 'baz'); $this->assertEquals($mock->fizz, 'buzz'); }