Completed
Push — master ( 0bad36...7c076d )
by Steve
01:35
created

spec/Renderer/JsonSpec.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace spec\MeadSteve\DiceApi\Renderer;
4
5
use MeadSteve\DiceApi\Dice;
6
use PhpSpec\ObjectBehavior;
7
use Prophecy\Argument;
8
9
class JsonSpec extends ObjectBehavior
10
{
11
    function it_is_initializable()
12
    {
13
        $this->shouldHaveType(\MeadSteve\DiceApi\Renderer\Json::class);
14
    }
15
16 View Code Duplication
    function it_uses_the_json_encode_function_of_the_dice(Dice $dice)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18
        $dice->roll()->willReturn(5);
19
        $dice->name()->willReturn("d6");
20
21
        $expectedJson = '{"success":true,"dice":[{"value":5,"type":"d6"}]}';
22
        $this->renderDice([$dice])->shouldReturn($expectedJson);
23
    }
24
}
25