1 | <?php |
||
2 | |||
3 | namespace andmemasin\myabstract\test; |
||
4 | use yii\base\Model; |
||
5 | |||
6 | /** |
||
7 | * Trait ModelTestTrait |
||
8 | * @package andmemasin\myabstract\traits |
||
9 | * @author Tõnis Ormisson <[email protected]> |
||
10 | * @property Model $model |
||
11 | */ |
||
12 | trait ModelTestTrait |
||
13 | { |
||
14 | public function testAttributeLabelsForExistingAttributesOnly() { |
||
15 | // labels only for actually existing attributes |
||
16 | foreach ($this->model->attributeLabels() as $key => $label) { |
||
17 | $this->assertArrayHasKey($key, $this->model->attributes); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
18 | } |
||
19 | } |
||
20 | public function testAttributeHintsForExistingAttributesOnly() { |
||
21 | // labels only for actually existing attributes |
||
22 | foreach ($this->model->attributeHints() as $key => $label) { |
||
23 | $this->assertArrayHasKey($key, $this->model->attributes); |
||
24 | } |
||
25 | } |
||
26 | public function testRulesForExistingAttributesOnly() { |
||
27 | // labels only for actually existing attributes |
||
28 | foreach ($this->model->rules() as $rule) { |
||
29 | foreach ($rule[0] as $attribute) { |
||
30 | $this->assertArrayHasKey($attribute, $this->model->attributes); |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | |||
35 | |||
36 | } |