Completed
Pull Request — master (#335)
by Simon
07:27 queued 03:11
created

SupplierConditionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 24
rs 10
c 2
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_it_can_be_created() 0 7 1
A test_it_should_only_accept_integer() 0 7 1
A test_it_should_throw_exception_if_non_intergish_values_are_given() 0 5 1
1
<?php
2
/**
3
 * (c) shopware AG <[email protected]>
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace ShopwarePlugins\Connect\Tests\Unit\Bundle\SearchBundle\Condition;
9
10
use Assert\InvalidArgumentException;
11
use Shopware\Bundle\SearchBundle\ConditionInterface;
12
use ShopwarePlugins\Connect\Bundle\SearchBundle\Condition\SupplierCondition;
13
use ShopwarePlugins\Connect\Tests\AbstractConnectUnitTest;
14
15
class SupplierConditionTest extends AbstractConnectUnitTest
16
{
17
    public function test_it_can_be_created()
18
    {
19
        $condition = new SupplierCondition([]);
20
21
        $this->assertInstanceOf(SupplierCondition::class, $condition);
22
        $this->assertInstanceOf(ConditionInterface::class, $condition);
23
    }
24
25
    public function test_it_should_only_accept_integer()
26
    {
27
        $condition = new SupplierCondition([ "1" ]);
28
29
        $this->assertInstanceOf(SupplierCondition::class, $condition);
30
        $this->assertInstanceOf(ConditionInterface::class, $condition);
31
    }
32
33
    public function test_it_should_throw_exception_if_non_intergish_values_are_given()
34
    {
35
        $this->expectException(InvalidArgumentException::class);
36
        new SupplierCondition([ "asdfasdf" ]);
37
    }
38
}
39