Code Duplication    Length = 29-29 lines in 2 locations

src/OroCRM/Bundle/MagentoBundle/Tests/Unit/Acl/Voter/CustomerVoterTest.php 1 location

@@ 40-68 (lines=29) @@
37
     *
38
     * @dataProvider attributesDataProvider
39
     */
40
    public function testVote($object, $className, $attributes, $hasApplicableChannels, $isChannelApplicable, $expected)
41
    {
42
        $this->doctrineHelper->expects($this->any())
43
            ->method('getEntityClass')
44
            ->with($object)
45
            ->will($this->returnValue($className));
46
47
        $this->voter->setClassName('OroCRM\Bundle\MagentoBundle\Entity\Customer');
48
49
        $this->doctrineHelper->expects($this->any())
50
            ->method('getSingleEntityIdentifier')
51
            ->with($object, false)
52
            ->will($this->returnValue(1));
53
54
        $this->settingsProvider->expects($this->any())
55
            ->method('isChannelApplicable')
56
            ->will($this->returnValue($isChannelApplicable));
57
58
        $this->settingsProvider->expects($this->any())
59
            ->method('hasApplicableChannels')
60
            ->will($this->returnValue($hasApplicableChannels));
61
62
        /** @var TokenInterface $token */
63
        $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
64
        $this->assertEquals(
65
            $expected,
66
            $this->voter->vote($token, $object, $attributes)
67
        );
68
    }
69
70
    /**
71
     * @return array

src/OroCRM/Bundle/MagentoBundle/Tests/Unit/Acl/Voter/NewsletterSubscriberVoterTest.php 1 location

@@ 40-68 (lines=29) @@
37
     *
38
     * @dataProvider attributesDataProvider
39
     */
40
    public function testVote($object, $className, $attributes, $hasApplicableChannels, $isChannelApplicable, $expected)
41
    {
42
        $this->doctrineHelper->expects($this->any())
43
            ->method('getEntityClass')
44
            ->with($object)
45
            ->will($this->returnValue($className));
46
47
        $this->voter->setClassName('OroCRM\Bundle\MagentoBundle\Entity\NewsletterSubscriber');
48
49
        $this->doctrineHelper->expects($this->any())
50
            ->method('getSingleEntityIdentifier')
51
            ->with($object, false)
52
            ->will($this->returnValue(1));
53
54
        $this->settingsProvider->expects($this->any())
55
            ->method('isChannelApplicable')
56
            ->will($this->returnValue($isChannelApplicable));
57
58
        $this->settingsProvider->expects($this->any())
59
            ->method('hasApplicableChannels')
60
            ->will($this->returnValue($hasApplicableChannels));
61
62
        /** @var TokenInterface $token */
63
        $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
64
        $this->assertEquals(
65
            $expected,
66
            $this->voter->vote($token, $object, $attributes)
67
        );
68
    }
69
70
    /**
71
     * @return array