If you have docker and docker-compose installed than:
docker-compose up
Installing on bare metal (you need PHP 7+):
composer install
Unit tests are provided in the /tests
folder. To run these steps simply run following command from the project root:
bin/phpunit
- Used newest version of PHP (7.1)
- Tests implemented using PHPUnit 6 + including phpunit.xml config for easy execution
- Autoloading classes by composer (PSR-4 standard)
- Follows PSR-1, PSR-2 & PSR-4 guidelines
- Utilized Carbon PHP library for easier and more reliable manipulation of DateTime
- Made Allowed IPs configurable for each banner instance (on top of default ones as per specification)
- Current DateTime for deciding whether banner is displayed is also configurable for each
Banner::isDisplayable()
call (more flexibility)
- Validate IP address format (with regex)
- More options for the configuration
- Accept directly Carbon classes in the
Banner
constructor or even betterDisplayPeriod
instance - More test cases possibly also with the data provider to cover multiple inputs with the same scenarios