Blame view

tests/unit/ValidatorTest.php 798 Bytes
b50f5ce3   Yarik   test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  <?php
  namespace tests\unit;
  use common\components\UserStore;
  
  use common\components\Validator;
  use Yii;
  
  class ValidatorTest extends \Codeception\TestCase\Test
  {
      public  function testValidate_FalsePass(){
          $store = $this->getMock('common\components\UserStore');
          $this->validator = new Validator($store);
          $store->expects($this->once())
              ->method('notifyPasswordFailure')
              ->with($this->equalTo("test@emails.com"));
  
          $store->expects($this->any())
              ->method("getUser")
              ->will($this->returnValue([
                  "name"=>"fdsfdf",
                  "email"=>"test@emails.com",
                  "pass"=>"rihfhh"
              ]));
  
          $this->assertFalse($this->validator->validateUser("test@emails.com", "wrong"));
      }
  }