Code Duplication    Length = 24-24 lines in 2 locations

tests/HttpClients/FacebookGuzzleHttpClientTest.php 2 locations

@@ 61-84 (lines=24) @@
58
        $this->guzzleMock
59
            ->shouldReceive('createRequest')
60
            ->once()
61
            ->with('GET', 'http://foo.com/', m::on(function ($arg) {
62
63
                // array_diff_assoc() will sometimes trigger error on child-arrays
64
                if (['X-foo' => 'bar'] !== $arg['headers']) {
65
                    return false;
66
                }
67
                unset($arg['headers']);
68
69
                $caInfo = array_diff_assoc($arg, [
70
                    'body' => 'foo_body',
71
                    'timeout' => 123,
72
                    'connect_timeout' => 10,
73
                ]);
74
75
                if (count($caInfo) !== 1) {
76
                    return false;
77
                }
78
79
                if (1 !== preg_match('/.+\/certs\/DigiCertHighAssuranceEVRootCA\.pem$/', $caInfo['verify'])) {
80
                    return false;
81
                }
82
83
                return true;
84
            }))
85
            ->andReturn($request);
86
        $this->guzzleMock
87
            ->shouldReceive('send')
@@ 110-133 (lines=24) @@
107
        $this->guzzleMock
108
            ->shouldReceive('createRequest')
109
            ->once()
110
            ->with('GET', 'http://foo.com/', m::on(function ($arg) {
111
112
                // array_diff_assoc() will sometimes trigger error on child-arrays
113
                if ([] !== $arg['headers']) {
114
                    return false;
115
                }
116
                unset($arg['headers']);
117
118
                $caInfo = array_diff_assoc($arg, [
119
                    'body' => 'foo_body',
120
                    'timeout' => 60,
121
                    'connect_timeout' => 10,
122
                ]);
123
124
                if (count($caInfo) !== 1) {
125
                    return false;
126
                }
127
128
                if (1 !== preg_match('/.+\/certs\/DigiCertHighAssuranceEVRootCA\.pem$/', $caInfo['verify'])) {
129
                    return false;
130
                }
131
132
                return true;
133
            }))
134
            ->andReturn($request);
135
        $this->guzzleMock
136
            ->shouldReceive('send')