mirror of
https://github.com/elyby/accounts.git
synced 2024-10-31 07:53:02 +05:30
32 lines
762 B
PHP
32 lines
762 B
PHP
|
<?php
|
||
|
namespace tests\codeception\api\models;
|
||
|
|
||
|
use api\models\BaseApiForm;
|
||
|
use Codeception\Specify;
|
||
|
use tests\codeception\api\unit\TestCase;
|
||
|
|
||
|
class BaseApiFormTest extends TestCase {
|
||
|
use Specify;
|
||
|
|
||
|
public function testLoad() {
|
||
|
$model = new DummyTestModel();
|
||
|
$this->specify('model should load data without ModelName array scope', function() use ($model) {
|
||
|
expect('model successful load data without prefix', $model->load(['field' => 'test-data']))->true();
|
||
|
expect('field is set as passed data', $model->field)->equals('test-data');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
class DummyTestModel extends BaseApiForm {
|
||
|
|
||
|
public $field;
|
||
|
|
||
|
public function rules() {
|
||
|
return [
|
||
|
['field', 'safe'],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
}
|