Hi, team
It's Michael Bodnarchuk, from Codeception project.
I was preparing a training on testing and stumbled upon Flarum as well-architected project with almost no tests.
I want to use it to demonstrate how to implement unit/integration tests for complex domains.
I really like how nice they look now:
public function testAdminCanStartADiscussion()
{
// ARRANGE: create command object with all required params
$command = new StartDiscussion($this->admin, [
'attributes' => [
'title' => 'How about some tests?',
'content' => 'We discuss testing in this thread'
]
], '127.0.0.1');
// ACT: proceed with handler
$discussion = $this->handler->handle($command);
// ASSERT: check response
$this->assertNotNull($discussion);
}
If you are interested in implementing more tests to Flarum I could make a training for you. And provide additional consulting on how to structure tests.
And thanks for a great project!