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