Completed
Pull Request — master (#145)
by Adrien
02:31
created

BadgeUnlockerTest::testUnlockBadgeFromClaim()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace Badger\Bundle\GameBundle\Tests\Unlocker;
4
5
use Badger\BadgerTestCase;
6
7
/**
8
 * @author    Marie Bochu <[email protected]>
9
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
10
 */
11
class BadgeUnlockerTest extends BadgerTestCase
12
{
13 View Code Duplication
    public function testUnlockBadge()
0 ignored issues
show
Duplication introduced by
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...
14
    {
15
        $user = $this->get('badger.user.repository.user')->findOneBy(['username' => 'user_1']);
16
        $badge = $this->get('badger.game.repository.badge')->findOneBy(['title' => 'Bug Hunter']);
17
18
        $count = count($this->get('badger.game.repository.badge_completion')->getCompletionBadgesByUser($user));
19
20
        $this->get('badger.game.unlocker.badge')->unlockBadge($user, $badge);
21
22
        $this->assertCount($count += 1, $this->get('badger.game.repository.badge_completion')->getCompletionBadgesByUser($user));
23
    }
24
25 View Code Duplication
    public function testUnlockBadgeWhenUserHasAlreadyTheBadge()
0 ignored issues
show
Duplication introduced by
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...
26
    {
27
        $user = $this->get('badger.user.repository.user')->findOneBy(['username' => 'user_2']);
28
        $badge = $this->get('badger.game.repository.badge')->findOneBy(['title' => 'Bug Hunter']);
29
30
        $count = count($this->get('badger.game.repository.badge_completion')->getCompletionBadgesByUser($user));
31
32
        $this->get('badger.game.unlocker.badge')->unlockBadge($user, $badge);
33
34
        $this->assertCount($count, $this->get('badger.game.repository.badge_completion')->getCompletionBadgesByUser($user));
35
    }
36
}
37