FakeFactory::win32Model()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace PhpWinTools\WmiScripting\Testing;
4
5
use PHPUnit\Framework\TestCase;
6
use PhpWinTools\WmiScripting\Configuration\Config;
7
use PhpWinTools\WmiScripting\Testing\Support\Assert;
8
use PhpWinTools\WmiScripting\Testing\Wmi\Win32ModelFactory;
9
use PhpWinTools\WmiScripting\Testing\Responses\ObjectSetResponse;
10
use PhpWinTools\WmiScripting\Testing\Responses\ConnectionResponse;
11
12
class FakeFactory
13
{
14
    protected $testCase;
15
16
    protected $config;
17
18 2
    public function __construct(TestCase $testCase, Config $config = null)
19
    {
20 2
        $this->testCase = $testCase;
21 2
        $this->config = $config ?? Config::testInstance();
22 2
    }
23
24 2
    public function win32Model($class_name, int $count = 1, array $attributes = [])
25
    {
26 2
        ConnectionResponse::standard($this->config);
27 2
        ObjectSetResponse::standard(Win32ModelFactory::make($class_name, $count, $attributes));
28
29 2
        return new Assert($this->testCase);
30
    }
31
}
32