本文整理汇总了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));
}