Skip to content

Commit 0508049

Browse files
committed
Add test for decrement method.
1 parent 35126fd commit 0508049

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/Tests/Units/Client/Client.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ protected function getMockedClient()
2020
{
2121
$this->mockGenerator->orphanize('__construct');
2222
$this->mockGenerator->orphanize('increment');
23+
$this->mockGenerator->orphanize('decrement');
2324
$this->mockGenerator->orphanize('timing');
2425
$client = new \mock\M6Web\Bundle\StatsdBundle\Client\Client();
2526
$client->clearToSend();
@@ -51,6 +52,29 @@ public function testHandleEventWithValidConfigIncrement()
5152

5253
}
5354

55+
/**
56+
* testHandleEventWithValidConfig
57+
*/
58+
public function testHandleEventWithValidConfigDecrement()
59+
{
60+
$client = $this->getMockedClient();
61+
62+
$event = new \Symfony\Component\EventDispatcher\Event();
63+
64+
$client->addEventToListen('test', array(
65+
'decrement' => 'stats.<name>'
66+
));
67+
68+
$this->if($client->handleEvent($event, 'test'))
69+
->then
70+
->mock($client)
71+
->call('decrement')
72+
->withArguments('stats.test')
73+
->once()
74+
->call('send')
75+
->never();
76+
}
77+
5478
/**
5579
* testHandleEventWithImmediateSend
5680
*/

0 commit comments

Comments
 (0)