improbable_airtime
Member
I've adopted a TDD workflow the past few months and obviously since Laravel comes with PHPUnit and a whole testing suite working out the box, this is pretty neat.
But I need to work on an app that interacts with XenForo in a variety of different ways, most of which will be accomplished by including the
However, one thing I've been struggling to figure out in my head is how exactly I can approach this TDD workflow when I rely on structures/data from XenForo?
For example, a bit of an explanation/pseudo.
I'm not sure if this is really within the scope of XF specifically, but I'd like to hear if anyone else has been in a similar situation to this and has got a decent setup. I'm obviously running a local version of XF on my machine for dev purposes so I have no concerns for "possible data corruption" forum wise or anything like that. This is purely for me to generate new forum users, posts, etc... And assert against them, then they are no longer needed and can be deleted.
Hopefully someone can provide a solution!
But I need to work on an app that interacts with XenForo in a variety of different ways, most of which will be accomplished by including the
XF.php
file and using classes and functions directly.However, one thing I've been struggling to figure out in my head is how exactly I can approach this TDD workflow when I rely on structures/data from XenForo?
For example, a bit of an explanation/pseudo.
Code:
// My Laravel app has it's own "User" model that has a column for a users forum_id.
// I don't particularly want to mock it, and I'd like to test with a variety of different users.
// My solution to this would be to make my own custom "Factory" that creates new XF users via `XF.php`
// (Even the above I'm unsure if it's possible, but I'm sure I could get it to work somehow.
// But then comes "cleanup". After a test is run, that user that was created should be deleted and should no longer exist.
// Same concept with various other things like; Threads, Comments, etc... Not really sure how to accomplish this "cleanup".
I'm not sure if this is really within the scope of XF specifically, but I'd like to hear if anyone else has been in a similar situation to this and has got a decent setup. I'm obviously running a local version of XF on my machine for dev purposes so I have no concerns for "possible data corruption" forum wise or anything like that. This is purely for me to generate new forum users, posts, etc... And assert against them, then they are no longer needed and can be deleted.
Hopefully someone can provide a solution!