public function testAttributeManipulation()
 {
     $model = new EloquentModelStub();
     $model->name = 'foo';
     $this->assertEquals('foo', $model->name);
     $this->assertTrue(isset($model->name));
     unset($model->name);
     $this->assertFalse(isset($model->name));
     // test mutation
     $model->list_items = array('name' => 'taylor');
     $this->assertEquals(array('name' => 'taylor'), $model->list_items);
     $attributes = $model->getAttributes();
     $this->assertEquals(json_encode(array('name' => 'taylor')), $attributes['list_items']);
 }
示例#2
0
 public function testUnderscorePropertiesAreNotFilled()
 {
     $model = new EloquentModelStub();
     $model->fill(['_method' => 'PUT']);
     $this->assertEquals([], $model->getAttributes());
 }