@@ 483-504 (lines=22) @@ | ||
480 | } |
|
481 | ||
482 | /** @test */ |
|
483 | public function simpleStrictPerfectPassed() |
|
484 | { |
|
485 | $string = '1a2b3c'; |
|
486 | ||
487 | $password = new Password(); |
|
488 | ||
489 | $password->addCriteria(new Dictionaries\Digit(), new Occurrences\Strict(3)); |
|
490 | $password->addCriteria(new Dictionaries\Letter(), new Occurrences\Strict(3)); |
|
491 | ||
492 | $expectedArray = [ |
|
493 | [ |
|
494 | 'name' => 'digit_strict_3', |
|
495 | 'passed' => true, |
|
496 | ], |
|
497 | [ |
|
498 | 'name' => 'letter_strict_3', |
|
499 | 'passed' => true, |
|
500 | ], |
|
501 | ]; |
|
502 | ||
503 | $this->assertEquals($expectedArray, $password->passed($string)); |
|
504 | } |
|
505 | ||
506 | /** @test */ |
|
507 | public function simpleBetweenPerfectPassed() |
|
@@ 507-528 (lines=22) @@ | ||
504 | } |
|
505 | ||
506 | /** @test */ |
|
507 | public function simpleBetweenPerfectPassed() |
|
508 | { |
|
509 | $string = '1a2b3c4'; |
|
510 | ||
511 | $password = new Password(); |
|
512 | ||
513 | $password->addCriteria(new Dictionaries\Digit(), new Occurrences\Between(3, 5)); |
|
514 | $password->addCriteria(new Dictionaries\Letter(), new Occurrences\Between(3, 5)); |
|
515 | ||
516 | $expectedArray = [ |
|
517 | [ |
|
518 | 'name' => 'digit_between_3_5', |
|
519 | 'passed' => true, |
|
520 | ], |
|
521 | [ |
|
522 | 'name' => 'letter_between_3_5', |
|
523 | 'passed' => true, |
|
524 | ], |
|
525 | ]; |
|
526 | ||
527 | $this->assertEquals($expectedArray, $password->passed($string)); |
|
528 | } |
|
529 | ||
530 | /** @test */ |
|
531 | public function mixedIncompletePassed() |
|
@@ 570-591 (lines=22) @@ | ||
567 | } |
|
568 | ||
569 | /** @test */ |
|
570 | public function mixedPerfecPassedWithName() |
|
571 | { |
|
572 | $string = '1a2b3c'; |
|
573 | ||
574 | $password = new Password(); |
|
575 | ||
576 | $password->addCriteria(new Dictionaries\Digit(), new Occurrences\Strict(3)); |
|
577 | $password->addNamedCriteria('name', new Dictionaries\Letter(), new Occurrences\Between(3, 5)); |
|
578 | ||
579 | $expectedArray = [ |
|
580 | [ |
|
581 | 'name' => 'digit_strict_3', |
|
582 | 'passed' => true, |
|
583 | ], |
|
584 | [ |
|
585 | 'name' => 'name', |
|
586 | 'passed' => true, |
|
587 | ], |
|
588 | ]; |
|
589 | ||
590 | $this->assertEquals($expectedArray, $password->passed($string)); |
|
591 | } |
|
592 | } |
|
593 |