Completed
Push — master ( 0b658a...cae295 )
by
unknown
54:13
created

WebsiteDataConverterTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace OroCRM\Bundle\MagentoBundle\Tests\Unit\Importexport\Processor;
4
5
use OroCRM\Bundle\MagentoBundle\ImportExport\Converter\WebsiteDataConverter;
6
7
class WebsiteDataConverterTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * @var WebsiteDataConverter
11
     */
12
    protected $dataConverter;
13
14
    protected function setUp()
15
    {
16
        $this->dataConverter = new WebsiteDataConverter();
17
    }
18
19
    public function testConvertToImportFormat()
20
    {
21
        $result = $this->dataConverter->convertToImportFormat(['name' => 'test', 'code' => 'test_test']);
22
23
        $this->assertArrayHasKey('name', $result);
24
        $this->assertArrayHasKey('code', $result);
25
26
        $this->assertEquals($result['name'], 'test');
27
        $this->assertEquals($result['code'], 'test_test');
28
    }
29
30
    public function testConvertToImportFormatWithLongName()
31
    {
32
        $longName = str_pad('test', 300, ', test', STR_PAD_RIGHT);
33
        $longCode = str_pad('test', 300, '/ test', STR_PAD_RIGHT);
34
35
        $result = $this->dataConverter->convertToImportFormat(['name' => $longName, 'code' => $longCode]);
36
37
        $this->assertEquals(mb_strlen($result['name']), 255);
38
        $this->assertEquals(mb_strlen($result['code']), 32);
39
    }
40
}
41