コード例 #1
0
ファイル: GenericTest.php プロジェクト: Joal01/fof
 /**
  * @group           DataModel
  * @group           DataModelValidateForm
  * @covers          FOF30\Model\DataModel::validateForm
  * @dataProvider    DataModelGenericDataprovider::getTestValidateForm
  */
 public function testValidateForm($test, $check)
 {
     $msg = 'DataModel::validateForm %s - Case: ' . $check['case'];
     $config = array('idFieldName' => 'foftest_bare_id', 'tableName' => '#__foftest_bares');
     $model = new DataModelStub(static::$container, $config);
     $form = $this->getMock('FOF30\\Form\\Form', array('filter', 'validate', 'getErrors'), array(static::$container, 'Foobar'));
     $form->expects($this->any())->method('filter')->willReturn($test['mock']['filter']);
     $form->expects($this->any())->method('validate')->willReturn($test['mock']['validate']);
     $form->expects($this->any())->method('getErrors')->willReturn($test['mock']['errors']);
     if ($check['exception']) {
         $this->setExpectedException($check['exception'], $check['message']);
     }
     $result = $model->validateForm($form, array(), '');
     $this->assertEquals($check['result'], $result, sprintf($msg, 'Returned the wrong result'));
 }