Testing Extension's Listener

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Toxyy
Registered User
Posts: 807
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Testing Extension's Listener

Post 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.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][BETA] Sticky Ad || [3.2][RC] Show User Activity ||
[3.2][DEV] User Delete Topics || [3.3][RC] Short Number Twig Extension
User avatar
AbaddonOrmuz
Recognised Extension Developer
Posts: 1002
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo
Contact:

Re: Testing Extension's Listener

Post 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
Some of my phpBB extensions:
Image Imgur | :chart_with_upwards_trend: SEO Metadata | Image Markdown | :lock: Auto-lock Topics
:trophy: Check out all my validated extensions :trophy:

:penguin: Arch Linux user :penguin:
Post Reply

Return to “Extension Writers Discussion”