本文整理匯總了PHP中Mockery::fillModel方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mockery::fillModel方法的具體用法?PHP Mockery::fillModel怎麽用?PHP Mockery::fillModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mockery
的用法示例。
在下文中一共展示了Mockery::fillModel方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFillModelNullInput
public function testFillModelNullInput()
{
$model = new \stdClass();
$this->field->shouldReceive('getOption')->once()->andReturn('field')->shouldReceive('parseNumber')->never();
$this->field->fillModel($model, null);
$this->assertEquals($model->field, null);
}
示例2: testFillModelFalse
public function testFillModelFalse()
{
$model = new \stdClass();
$this->field->shouldReceive('getOption')->once()->andReturn('field');
$this->field->fillModel($model, 'false');
$this->assertEquals($model->field, 0);
}
示例3: testFillModelWithoutInput
public function testFillModelWithoutInput()
{
$model = new BelongsToEloquentStub();
$model->rel = '3';
$this->field->shouldReceive('getOption')->twice()->andReturn('rel_id', 'rel');
$this->field->fillModel($model, 'false');
$this->assertEquals($model->rel_id, null);
$this->assertTrue(!isset($model->rel));
}
示例4: testFillModel
public function testFillModel()
{
$input = m::mock('Illuminate\\Http\\Request');
$input->shouldReceive('get')->times(3);
$field = m::mock('Frozennode\\Administrator\\Fields\\Field');
$field->shouldReceive('getOption')->times(4)->andReturn(false, true, 'text', false)->shouldReceive('fillModel')->once();
$field_external = m::mock('Frozennode\\Administrator\\Fields\\Field');
$field_external->shouldReceive('getOption')->times(3)->andReturn(true, 'belongs_to_many', false);
$field_uneditable = m::mock('Frozennode\\Administrator\\Fields\\Field');
$field_uneditable->shouldReceive('getOption')->times(4)->andReturn(false, false, 'text', false);
$field_setter = m::mock('Frozennode\\Administrator\\Fields\\Field');
$field_setter->shouldReceive('getOption')->times(4)->andReturn(false, true, 'text', true)->shouldReceive('fillModel')->once();
$field_password = m::mock('Frozennode\\Administrator\\Fields\\Field');
$field_password->shouldReceive('getOption')->times(4)->andReturn(false, true, 'password', false)->shouldReceive('fillModel')->once();
$model = m::mock('stdClass')->makePartial();
$model->field = 'field_value';
$model->field_external = 'field_external_value';
$model->field_uneditable = 'field_uneditable_value';
$model->field_setter = 'field_setter_value';
$model->field_password = '';
$model->shouldReceive('__unset')->times(4);
$model->shouldReceive('getKeyName')->times(2);
$fields = array('field_external' => $field_external, 'field_uneditable' => $field_uneditable, 'field_setter' => $field_setter, 'field_password' => $field_password, 'field' => $field);
$this->config->fillModel($model, $input, $fields);
}
示例5: testFillModelWithoutSortField
public function testFillModelWithoutSortField()
{
$model = new BelongsToManyEloquentStub;
$this->field->shouldReceive('getOption')->twice()->andReturn('fieldNoSort', false);
$this->field->fillModel($model, '3,4,5');
$this->assertTrue(!isset($model->rel));
}
示例6: testFillModelBadInput
public function testFillModelBadInput()
{
$model = new \stdClass();
$this->field->shouldReceive('getOption')->never()->shouldReceive('getDateString')->never();
$this->field->fillModel($model, null);
$this->assertTrue(!isset($model->field));
}
示例7: testFillModelWithZeros
public function testFillModelWithZeros()
{
$model = new \stdClass();
$this->field->shouldReceive('getOption')->never()->shouldReceive('getDateString')->never();
$this->field->fillModel($model, '0000-00-00');
$this->assertTrue(!isset($model->field));
}