vezaynk / Sitemap-Generator-Crawler

PHP script to recursively crawl websites and generate a sitemap. Zero dependencies.
https://www.bbss.dev
MIT License
241 stars 92 forks source link

Add the first unit tests #52

Closed villfa closed 6 years ago

villfa commented 6 years ago

Related to #7.

To make the code testable I had to move the functions in their own file.

PHPUnit is the testing framework used to write the tests.

To install PHPUnit use Composer:

composer install

Then to run the tests:

./vendor/bin/phpunit

For now only 2 functions are tested (ends_with and check_blacklist). These tests may serve as example.

vezaynk commented 6 years ago

Sorry for the delay. I wanted to do all of this earlier today but the systems were malfunctioning. Going to run a few tests and merge this pronto!

vezaynk commented 6 years ago

Good stuff. I renamed the file from functions.php to sitemap.functions.php to avoid any possible conflicts with other files.