Completed
Pull Request — master (#28)
by
unknown
01:16
created

OfferDeliveryOptionsGeneratorTest::createOffer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Delivery;
15
use Bukashk0zzz\YmlGenerator\Model\Offer\OfferSimple;
16
17
/**
18
 * Generator test
19
 */
20
class OfferDeliveryOptionsGeneratorTest extends AbstractGeneratorTest
21
{
22
    /**
23
     * Test generate
24
     */
25
    public function testGenerate()
26
    {
27
        $this->offerType = 'OfferDeliveryOptions';
28
        $this->runGeneratorTest();
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function createOffer()
35
    {
36
        return (new OfferSimple())
37
            ->setName($this->faker->name)
38
            ->setVendor($this->faker->company)
39
            ->setVendorCode(null)
40
            ->setPickup(true)
41
            ->addDeliveryOption(
42
                (new Delivery)->setCost(10)->setDays(1)->setOrderBefore(14),
43
                (new Delivery)->setCost(10)->setDays(1)->setOrderBefore(14)
0 ignored issues
show
Unused Code introduced by
The call to OfferSimple::addDeliveryOption() has too many arguments starting with (new \Bukashk0zzz\YmlGen...(1)->setOrderBefore(14).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
44
                )
45
            ->setGroupId($this->faker->numberBetween())
46
            ->addPicture('http://example.com/example.jpeg')
47
            ->addBarcode($this->faker->ean13)
48
            ->setCategoriesId([1, 2, 3])
49
            ->setCategoryId(999)
50
        ;
51
    }
52
}
53