Code Duplication    Length = 36-36 lines in 2 locations

tests/ClientTest.php 2 locations

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