Clone https://github.com/bristol-php-training/php7-phpunit-password-validator
Run composer install
and then vendor/bin/phpunit
. Make sure basic test works.
Provide tests and solution for the method PasswordValidator::isValid
based on docblock.
Introduce password strength requirement. Look at interface.
Benefit of design to interface.
Options:
- Real
- Double
- Stub
- Mock
- Spy
- Fake
Go through why we need to do a test double:
- May not have real implementation
- Real implementation changes
- Don't know how to enter a password that scores 3 or 4.
- Create test mock. Include counts
- Add to existing tests
- Create a new tests
- Show with minimal
- Add in full mocks
- Show problem should use stub
- Stubs
- Mocks