2016-01-21 02:44:29 +05:30
|
|
|
<?php
|
2016-03-20 05:03:49 +05:30
|
|
|
namespace tests\codeception\api\models\base;
|
2016-01-21 02:44:29 +05:30
|
|
|
|
2016-03-20 05:03:49 +05:30
|
|
|
use api\models\base\ApiForm;
|
2016-01-21 02:44:29 +05:30
|
|
|
use tests\codeception\api\unit\TestCase;
|
|
|
|
|
2016-03-20 05:03:49 +05:30
|
|
|
class ApiFormTest extends TestCase {
|
|
|
|
|
2016-01-21 02:44:29 +05:30
|
|
|
public function testLoad() {
|
2016-03-20 05:03:49 +05:30
|
|
|
$model = new DummyApiForm();
|
2016-10-29 03:17:31 +05:30
|
|
|
$this->assertTrue($model->load(['field' => 'test-data']), 'model successful load data without prefix');
|
|
|
|
$this->assertEquals('test-data', $model->field, 'field is set as passed data');
|
2016-01-21 02:44:29 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-03-20 05:03:49 +05:30
|
|
|
class DummyApiForm extends ApiForm {
|
2016-01-21 02:44:29 +05:30
|
|
|
|
|
|
|
public $field;
|
|
|
|
|
|
|
|
public function rules() {
|
|
|
|
return [
|
|
|
|
['field', 'safe'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|