Giftregistry::isEnterprise()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
dl 6
loc 6
rs 10
c 0
b 0
f 0
nc 2
nop 0
1
<?php
2
/**
3
 * integer_net Magento Module
4
 *
5
 * @category   IntegerNet
6
 * @package    IntegerNet_Anonymizer
7
 * @copyright  Copyright (c) 2015 integer_net GmbH (http://www.integer-net.de/)
8
 * @author     Fabian Schmengler <[email protected]>
9
 */
10
11
/**
12
 * @group IntegerNet_Anonymizer
13
 */
14 View Code Duplication
class IntegerNet_Anonymizer_Test_Model_Bridge_Entity_Giftregistry
0 ignored issues
show
Duplication introduced by
This class 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...
15
    extends IntegerNet_Anonymizer_Test_Model_Bridge_Entity_Abstract
16
{
17
    /**
18
     * @test
19
     */
20
    public function isEnterprise()
21
    {
22
        if (Mage::getEdition() !== Mage::EDITION_ENTERPRISE) {
23
            $this->markTestSkipped('Skipping test for Magento Enterprise');
24
        }
25
    }
26
27
    /**
28
     * @param $registryId
29
     * @test
30
     * @depends isEnterprise
31
     * @dataProvider dataProvider
32
     * @dataProviderFile testGiftregistryBridge.yaml
33
     * @loadExpectation bridge.yaml
34
     * @loadFixture customers.yaml
35
     * @loadFixture enterprise.yaml
36
     */
37
    public function testGetValues($registryId)
38
    {
39
        /** @var IntegerNet_Anonymizer_Model_Bridge_Entity_Enterprise_Giftregistry $bridge */
40
        $bridge = Mage::getModel('integernet_anonymizer/bridge_entity_enterprise_giftregistry');
41
        /** @var Enterprise_GiftRegistry_Model_Entity $registry */
42
        $registry = $this->_loadEntityByCollection('entity_id', $registryId, $bridge);
43
        $expected = $this->expected('giftregistry_%d', $registryId);
44
45
        $this->_testGetValues($bridge, $registry, $expected);
46
    }
47
48
    /**
49
     * @param $registryId
50
     * @test
51
     * @depends isEnterprise
52
     * @dataProvider dataProvider
53
     * @dataProviderFile testGiftregistryBridge.yaml
54
     * @loadFixture customers.yaml
55
     * @loadFixture enterprise.yaml
56
     */
57
    public function testUpdateValues($registryId)
58
    {
59
        static $changedTitle = 'Changed Gift Registry Title';
60
61
        /** @var IntegerNet_Anonymizer_Model_Bridge_Entity_Enterprise_Giftregistry $bridge */
62
        $bridge = Mage::getModel('integernet_anonymizer/bridge_entity_enterprise_giftregistry');
63
64
        $dataProvider = Mage::getModel('enterprise_giftregistry/entity');
65
        $bridge->setRawData($dataProvider->load($registryId)->setId($registryId)->getData());
66
        $bridge->getValues()['title']->setValue($changedTitle);
67
68
        $this->_updateValues($bridge);
69
70
        $registry = Mage::getModel('enterprise_giftregistry/entity')->load($registryId);
71
        $this->assertEquals($changedTitle, $registry->getTitle());
72
    }
73
}