Code Duplication    Length = 20-23 lines in 2 locations

src/OroCRM/Bundle/MagentoBundle/Tests/Functional/Command/CopyCustomerAddressesToContactCommandTest.php 2 locations

@@ 43-62 (lines=20) @@
40
        $this->assertContains('Executing command finished.', $result);
41
    }
42
43
    public function testConvertAddressForCustomerById()
44
    {
45
        $testCustomer = $this->getReference('customer_1');
46
        $id = $testCustomer->getId();
47
48
        $entityManager = $this->getContainer()->get('doctrine');
49
        $repo = $entityManager->getRepository('OroCRM\Bundle\MagentoBundle\Entity\Customer');
50
        /** @var Customer $customer */
51
        $customer = $repo->find($id);
52
        self::assertEquals(0, $customer->getContact()->getAddresses()->count());
53
54
        $result = $this->runCommand('oro:magento:copy-data-to-contact:addresses', ['--id=' . $id]);
55
56
        /** @var Customer $customer */
57
        $customer = $repo->find($id);
58
        self::assertEquals(1, $customer->getContact()->getAddresses()->count());
59
60
        $this->assertContains('Executing command started.', $result);
61
        $this->assertContains('Executing command finished.', $result);
62
    }
63
64
    public function testConvertAddressForCustomerByIds()
65
    {
@@ 118-140 (lines=23) @@
115
        $this->assertContains('Executing command finished.', $result);
116
    }
117
118
    public function testConvertAddressForCustomerByIdAndAccountHasAddress()
119
    {
120
        $testCustomerId1 = $this->getReference('customer_1')->getId();
121
122
        $entityManager = $this->getContainer()->get('doctrine');
123
        $repo = $entityManager->getRepository('OroCRM\Bundle\MagentoBundle\Entity\Customer');
124
        /** @var Customer $customer */
125
        $customer = $repo->find($testCustomerId1);
126
        self::assertEquals(0, $customer->getContact()->getAddresses()->count());
127
128
        for ($i = 0; $i < 2; $i++) {
129
            $result = $this->runCommand('oro:magento:copy-data-to-contact:addresses', [
130
                '--id=' . $testCustomerId1
131
            ]);
132
        }
133
134
        /** @var Customer $customer */
135
        $customer = $repo->find($testCustomerId1);
136
        self::assertEquals(1, $customer->getContact()->getAddresses()->count());
137
138
        $this->assertContains('Executing command started.', $result);
139
        $this->assertContains('Executing command finished.', $result);
140
    }
141
}
142