Completed
Push — master ( 0f7b01...b73efb )
by Bukashk0zzz
02:11
created

OfferCustomGeneratorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 4
dl 0
loc 50
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGenerate() 0 5 1
B createOffers() 0 35 2
1
<?php
2
3
/*
4
 * This file is part of the Bukashk0zzzYmlGenerator
5
 *
6
 * (c) Denis Golubovskiy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Bukashk0zzz\YmlGenerator\Tests;
13
14
use Bukashk0zzz\YmlGenerator\Model\Offer\OfferCustom;
15
use Bukashk0zzz\YmlGenerator\Model\Offer\OfferParam;
16
17
/**
18
 * Generator test
19
 *
20
 * @author Denis Golubovskiy <[email protected]>
21
 */
22
class OfferCustomGeneratorTest extends AbstractGeneratorTest
23
{
24
    /**
25
     * Test generate
26
     */
27
    public function testGenerate()
28
    {
29
        $this->offerType = 'Custom';
30
        $this->runGeneratorTest();
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    protected function createOffers()
37
    {
38
        $offers = [];
39
        foreach (range(1, 5) as $offer) {
40
            $offers[] = (new OfferCustom())
41
                ->setId($offer)
42
                ->setAvailable($this->faker->boolean)
43
                ->setUrl($this->faker->url)
44
                ->setPrice($this->faker->numberBetween(1, 9999))
45
                ->setCurrencyId('UAH')
46
                ->setCategoryId($offer)
47
                ->setName($this->faker->name)
48
                ->setDelivery($this->faker->boolean)
49
                ->setLocalDeliveryCost($this->faker->numberBetween(1, 9999))
50
                ->setVendor($this->faker->company)
51
                ->setVendorCode($this->faker->companySuffix)
52
                ->setDescription($this->faker->sentence)
53
                ->setCountryOfOrigin('Украина')
54
                ->setAdult($this->faker->boolean)
55
                ->setTypePrefix($this->faker->colorName)
56
                ->setModel($this->faker->userName)
57
                ->setSalesNotes($this->faker->text(45))
58
                ->setManufacturerWarranty($this->faker->boolean)
59
                ->setDownloadable($this->faker->boolean)
60
                ->addParam(
61
                    (new OfferParam())
62
                        ->setName($this->faker->name)
63
                        ->setUnit($this->faker->text(5))
64
                        ->setValue($this->faker->text(10))
65
                )
66
            ;
67
        }
68
69
        return $offers;
70
    }
71
}
72