PHPackages                             survos/crawler-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. survos/crawler-bundle

ActiveSymfony-bundle

survos/crawler-bundle
=====================

Provides a way to create tests that crawl a site

2.0.182(5mo ago)14.6kMITPHPPHP ^8.4

Since Sep 19Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/survos/crawler-bundle)[ Packagist](https://packagist.org/packages/survos/crawler-bundle)[ GitHub Sponsors](https://github.com/kbond)[ RSS](/packages/survos-crawler-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (28)Versions (886)Used By (0)

CrawlerBundle
=============

[](#crawlerbundle)

One of the most basic ways to test a website is to simply go to the starting page and click on every link to make sure there are no pages broken.

Then repeat the process, but logged in as different users (e.g. as an administrator).

That's what this bundle does. Combine with code coverage, it's a fast and easy way to test. This can also be run in --dev

@todo: check out

```
composer req survos/crawler-bundle
# configure the users in packages/survos_crawler.yaml
bin/console survos:crawl
```

These are the steps

- Crawl the site and create a list of all the routes and paths visited by each user (slow)
- Generate a phpunit test with those routes
- Run the phpunit test (very fast)
- Check coverage with the test.

```
c d:sc:update --env=test --force

bin/console survos:crawl --env=test
```

Working example (without API Platform)
======================================

[](#working-example-without-api-platform)

```
symfony new smoketest-demo --webapp && cd smoketest-demo
composer config extra.symfony.allow-contrib true
composer require --dev orm-fixtures pierstoval/smoke-testing
echo "DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db" > .env.local
echo "DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db" > .env.test
echo "title,string,80,no," | sed "s/,/\n/g"  | bin/console make:entity Product
echo "description,text,yes," | sed "s/,/\n/g"  | bin/console make:entity Product
bin/console doctrine:schema:update --force --complete

echo ",," | sed "s/,/\n/g"  | bin/console make:crud Product --with-tests

sed -i "s|'app_app'|'app_homepage'|" src/Controller/ProductController.php --with-tests

bin/console make:controller AppController
sed -i "s|Route('/app'|Route('/'|" src/Controller/AppController.php
sed -i "s|'app_app'|'app_homepage'|" src/Controller/AppController.php
sed -i "s||\n|" phpunit.xml.dist

cat > templates/app/index.html.twig
