GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 7d8259...93df27 )
by Alexsandr
02:41
created

YandexMarketYmlModuleTest::testBuildYml()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 55
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 55
rs 9.7692
c 1
b 0
f 0
cc 1
eloc 42
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace tests;
4
5
use Yii;
6
use tests\models\Category;
7
use corpsepk\yml\models\Shop;
8
use corpsepk\yml\models\Offer;
9
use corpsepk\yml\YandexMarketYml;
10
11
/**
12
 * BuildYmlTest
13
 */
14
class YandexMarketYmlModuleTest extends \PHPUnit_Framework_TestCase
15
{
16
    public function testBuildYml()
17
    {
18
        Yii::$app->setModule('YandexMarketYml', [
19
            'class' => YandexMarketYml::className(),
20
            'cacheProvider' => new \yii\caching\DummyCache(),
21
        ]);
22
23
        /** @var YandexMarketYml $module */
24
        $module = Yii::$app->getModule('YandexMarketYml');
25
        $actual = $module->createControllerByID('default')->renderPartial('index', [
26
            'shop' => new Shop([
27
                'name' => 'MyCompanyName',
28
                'company' => 'LTD MyCompanyName',
29
                'url' => 'http://example.com',
30
                'currencies' => [
31
                    ['id' => 'RUR', 'rate' => 1]
32
                ],
33
                'categories' => [
34
                    new Category([
35
                        'id' => 1,
36
                        'name' => 'First Category',
37
                        'parentId' => null,
38
                    ]),
39
                ],
40
                'offers' => [
41
                    new Offer([
42
                        'id' => 1,
43
                        'available' => true,
44
                        'url' => 'http://example.com/item/1',
45
                        'price' => 1560,
46
                        'currencyId' => 'RUR',
47
                        'categoryId' => 1,
48
                        'picture' => 'http://example.com/images/1.jpg',
49
                        'name' => 'Jacket',
50
                        'vendor' => 'Manufacturer',
51
                        'description' => 'Item description',
52
                    ]),
53
                    new Offer([
54
                        'id' => 2,
55
                        'available' => false,
56
                        'url' => 'http://example.com/item/2',
57
                        'price' => 2360,
58
                        'currencyId' => 'RUR',
59
                        'categoryId' => 1,
60
                        'picture' => 'http://example.com/images/2.jpg',
61
                        'name' => 'T-shirt',
62
                        'vendor' => 'Manufacturer',
63
                        'description' => 'Items description',
64
                    ]),
65
                ]
66
            ]),
67
        ]);
68
        $expected = file_get_contents(__DIR__ . '/data/yml.bin');
69
        $this->assertEquals($expected, $actual);
70
    }
71
}