Skip to content

Commit 3a8bfd7

Browse files
committed
updated
1 parent 450f796 commit 3a8bfd7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

_posts/2017-08-04-writing-better-tests--riding-the-command-bus.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ CommandHandler takes a command, calls the infrastructure services, and sends the
4646
Also, mocks comes with their price. While integration test is really similar to the actual business code, unit test is bloated with mock definitions. It will get hard to maintain and support it really soon:
4747

4848
```php
49+
<?php
4950
// is that a business logic test?
5051
// but no business inside of it
5152
$eventDispatcher = $this->createMock(EventDispatcher::class);
@@ -80,6 +81,7 @@ We can use [StartDiscussionHandler](https://github.com/flarum/core/blob/master/s
8081
For integration tests, we need to initialize Application with its Dependency Injection Container. Then, we fetch `StartDiscussionHandler` out of it:
8182

8283
```php
84+
<?php
8385
protected function _before()
8486
{
8587
// initialize Flarum app
@@ -93,6 +95,7 @@ protected function _before()
9395
When the handler is prepared we can write the first basic test:
9496

9597
```php
98+
<?php
9699
public function testAdminCanStartADiscussion()
97100
{
98101
// ARRANGE: create command object with all required params

0 commit comments

Comments
 (0)