Page 1 of 1

Testing Extension's Listener

Posted: Mon Aug 03, 2020 6:40 pm
by Toxyy
I've seen a couple posts about testing in extensions but not exactly what I was hoping to do, or maybe I just don't understand it fully. The bulk of my code in an older extension I've been working on is within the listener and has to do with posts. I want to be able to test posting, deleting, moving, etc without having to do it manually each time. Are there any extensions that use these sorts of tests that I can view the source for?

For example, make a topic, make a post, make a list with these url parameters, account for extra db tables or columns and separate users, delete a certain post, move them, etc, and making sure the db working how I want it to the whole time.

Re: Testing Extension's Listener

Posted: Fri Aug 07, 2020 10:24 pm
by AbaddonOrmuz
I guess you are referring to functional tests.

The class phpbb_functional_test_case (tests/test_framework/phpbb_functional_test_case.php) allows you to create topics, posts, private messages, delete topics, etc.

Other actions could be triggered using DOMCrawler, like submitting form data.

You can see examples of that if you look inside the tests/functional/ directory of the phpBB GitHub repository.

Links worth reading:

- https://area51.phpbb.com/docs/dev/3.3.x ... sting.html
- https://symfony.com/doc/3.4/components/dom_crawler.html