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