Code Duplication    Length = 36-36 lines in 2 locations

tests/ClientTest.php 2 locations

@@ 39-74 (lines=36) @@
36
    }
37
38
39
    public function testLoginEncFlow()
40
    {
41
        $config = $this->getConfig();
42
43
        $soapClient = $this->getMockBuilder(SoapClient::class)
44
            ->disableOriginalConstructor()
45
            ->setMethods(['doLoginEnc', 'doQuerySysStatus', 'doSomethingAfterLogin'])
46
            ->getMock();
47
48
        //Allegro version key should be requested for first login per request
49
        $soapClient->expects($this->once())
50
            ->method('doQuerySysStatus')
51
            ->willReturn((object)['verKey' => 'someVersionKey']);
52
53
        //login
54
        $soapClient->expects($this->once())
55
            ->method('doLoginEnc')
56
            ->willReturn((object)['sessionHandlePart' => 'foo', 'userId' => 'bar']);
57
58
        $client = new Client($config, $soapClient);
59
60
        //check session handle
61
        $soapClient->expects($this->once())
62
            ->method('doSomethingAfterLogin')
63
            ->with($this->equalTo([
64
                'webapiKey' => $this->defaultConfigParams['apiKey'],
65
                'localVersion' => 'someVersionKey',
66
                'countryId' => $this->defaultConfigParams['countryCode'],
67
                'sessionId' => 'foo',
68
                'countryCode' => $this->defaultConfigParams['countryCode'],
69
                'sessionHandle' => 'foo',
70
                'someFakeRequestParam' => 'someFakeRequestValue'
71
            ]));
72
73
        $client->somethingAfterLogin(['someFakeRequestParam' => 'someFakeRequestValue']);
74
    }
75
76
77
    public function testLoginFlow()
@@ 77-112 (lines=36) @@
74
    }
75
76
77
    public function testLoginFlow()
78
    {
79
        $config = $this->getPlainPasswordConfig();
80
81
        $soapClient = $this->getMockBuilder(SoapClient::class)
82
            ->disableOriginalConstructor()
83
            ->setMethods(['doLogin', 'doQuerySysStatus', 'doSomethingAfterLogin'])
84
            ->getMock();
85
86
        //Allegro version key should be requested for first login per request
87
        $soapClient->expects($this->once())
88
            ->method('doQuerySysStatus')
89
            ->willReturn((object)['verKey' => 'someVersionKey']);
90
91
        //login
92
        $soapClient->expects($this->once())
93
            ->method('doLogin')
94
            ->willReturn((object)['sessionHandlePart' => 'foo', 'userId' => 'bar']);
95
96
        $client = new Client($config, $soapClient);
97
98
        //check session handle
99
        $soapClient->expects($this->once())
100
            ->method('doSomethingAfterLogin')
101
            ->with($this->equalTo([
102
                'webapiKey' => $this->defaultConfigParams['apiKey'],
103
                'localVersion' => 'someVersionKey',
104
                'countryId' => $this->defaultConfigParams['countryCode'],
105
                'sessionId' => 'foo',
106
                'countryCode' => $this->defaultConfigParams['countryCode'],
107
                'sessionHandle' => 'foo',
108
                'someFakeRequestParam' => 'someFakeRequestValue'
109
            ]));
110
111
        $client->somethingAfterLogin(['someFakeRequestParam' => 'someFakeRequestValue']);
112
    }
113
114
115
    /**