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