AbstractRequestTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A newRequest() 0 5 2
A newRequestWithInitTest() 0 6 1
1
<?php
2
3
namespace ByTIC\Omnipay\PlatiOnline\Tests\Message;
4
5
use ByTIC\Omnipay\PlatiOnline\Message\AbstractRequest;
6
use ByTIC\Omnipay\PlatiOnline\Tests\AbstractTest;
7
use Symfony\Component\HttpFoundation\Request as HttpRequest;
8
9
/**AbstractSoapRequestTrait
10
 * Class AbstractRequestTest
11
 * @package ByTIC\Omnipay\Mobilpay\Tests\Message
12
 */
13
abstract class AbstractRequestTest extends AbstractTest
14
{
15
    /**
16
     * @param string $class
17
     * @param array $data
18
     * @return AbstractRequest
19
     */
20
    protected function newRequestWithInitTest($class, $data, $httpRequest = null)
21
    {
22
        $request = $this->newRequest($class, $httpRequest);
23
        self::assertInstanceOf($class, $request);
24
        $request->initialize($data);
25
        return $request;
26
    }
27
28
    /**
29
     * @param string $class
30
     * @return AbstractRequest
31
     */
32
    protected function newRequest($class, $httpRequest= null)
33
    {
34
        $client = $this->getHttpClient();
35
        $httpRequest = $httpRequest ? $httpRequest : HttpRequest::createFromGlobals();
36
        return new $class($client, $httpRequest);
37
    }
38
}
39