Completed
Push — master ( 3cc3b2...768def )
by Vitaliy
01:53
created

InTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 25
rs 10
1
<?php
2
3
  namespace Tests\Fiv\Form\Validator;
4
5
  use Fiv\Form\Form;
6
  use Fiv\Form\FormData;
7
8
  /**
9
   *
10
   */
11
  class InTest extends \PHPUnit_Framework_TestCase {
12
13
14
    public function testIn() {
15
      $inValidator = new \Fiv\Form\Validator\In();
16
      $inValidator->setValues(['a', 'b', 'c']);
17
18
      $form = new Form();
19
      $form->input('inputName')
20
        ->addValidator($inValidator);
21
22
      $form->handle(new FormData('post', [
23
        $form->getUid() => 1,
24
        'inputName' => 'a',
25
      ]));
26
      $this->assertTrue($form->isValid());
27
28
      $form->handle(new FormData('post', [
29
        $form->getUid() => 1,
30
        'inputName' => 'd',
31
      ]));
32
      $this->assertFalse($form->isValid());
33
    }
34
35
  }
36