Code Duplication    Length = 21-23 lines in 5 locations

tests/unit/GigyaTest.php 5 locations

@@ 270-290 (lines=21) @@
267
        static::assertSame($gigyaResponse, $result);
268
    }
269
270
    public function testPassingParamsThroughToTheMethodWillPassThroughToGuzzle()
271
    {
272
        $gigyaResponse = $this->setupCall(
273
            'accounts.getAccountInfo',
274
            'https://socialize.eu1.gigya.com/socialize.notifyLogin',
275
            [
276
                'auth'   => 'gigya',
277
                'verify' => $this->certPath,
278
                'query'  => [
279
                    'param' => 'passedThrough',
280
                ],
281
            ],
282
            'key',
283
            'secret'
284
        );
285
        $client = $this->createClient();
286
287
        $result = $client->socialize()->notifyLogin(['param' => 'passedThrough']);
288
289
        static::assertSame($gigyaResponse, $result);
290
    }
291
292
    public function testCallingChildMethodsCallTheCorrectUri()
293
    {
@@ 292-312 (lines=21) @@
289
        static::assertSame($gigyaResponse, $result);
290
    }
291
292
    public function testCallingChildMethodsCallTheCorrectUri()
293
    {
294
        $gigyaResponse = $this->setupCall(
295
            'accounts.getAccountInfo',
296
            'https://fidm.eu1.gigya.com/fidm.saml.idp.getConfig',
297
            [
298
                'auth'   => 'gigya',
299
                'verify' => $this->certPath,
300
                'query'  => [
301
                    'params' => 'passedThrough',
302
                ],
303
            ],
304
            'key',
305
            'secret'
306
        );
307
        $client = $this->createClient();
308
309
        $result = $client->saml()->idp()->getConfig(['params' => 'passedThrough']);
310
311
        static::assertSame($gigyaResponse, $result);
312
    }
313
314
    public function testTfaCallingChildMethodsCallTheCorrectUri()
315
    {
@@ 314-334 (lines=21) @@
311
        static::assertSame($gigyaResponse, $result);
312
    }
313
314
    public function testTfaCallingChildMethodsCallTheCorrectUri()
315
    {
316
        $gigyaResponse = $this->setupCall(
317
            'accounts.getAccountInfo',
318
            'https://accounts.eu1.gigya.com/accounts.tfa.getCertificate',
319
            [
320
                'auth'   => 'gigya',
321
                'verify' => $this->certPath,
322
                'query'  => [
323
                    'params' => 'passedThrough',
324
                ],
325
            ],
326
            'key',
327
            'secret'
328
        );
329
        $client = $this->createClient();
330
331
        $result = $client->accounts()->tfa()->getCertificate(['params' => 'passedThrough']);
332
333
        static::assertSame($gigyaResponse, $result);
334
    }
335
336
    /**
337
     * @dataProvider clientCallDataProvider
@@ 583-605 (lines=23) @@
580
        static::assertSame($gigyaResponse, $result);
581
    }
582
583
    public function testSettingParamsWillNotOverwriteTheDefaultParams()
584
    {
585
        $gigyaResponse = $this->setupCall(
586
            'accounts.getAccountInfo',
587
            'https://accounts.eu1.gigya.com/accounts.getAccountInfo',
588
            [
589
                'auth'   => 'gigya',
590
                'verify' => $this->certPath,
591
                'query'  => [
592
                    'secret' => 'newSecret',
593
                ],
594
            ],
595
            'key',
596
            'secret'
597
        );
598
        $client = $this->createClient();
599
600
        $result = $client->accounts()->getAccountInfo(
601
            ['secret' => 'newSecret']
602
        );
603
604
        static::assertSame($gigyaResponse, $result);
605
    }
606
607
    public function testCallingAChainWillCallThatChain()
608
    {
@@ 607-629 (lines=23) @@
604
        static::assertSame($gigyaResponse, $result);
605
    }
606
607
    public function testCallingAChainWillCallThatChain()
608
    {
609
        $gigyaResponse = $this->setupCall(
610
            'accounts.getAccountInfo',
611
            'https://fidm.eu1.gigya.com/fidm.saml.idp.getConfig',
612
            [
613
                'auth'   => 'gigya',
614
                'verify' => $this->certPath,
615
                'query'  => [
616
                    'secret' => 'newSecret',
617
                ],
618
            ],
619
            'key',
620
            'secret'
621
        );
622
        $client = $this->createClient();
623
624
        $result = $client->fidm()->{'saml.idp.getConfig'}(
625
            ['secret' => 'newSecret']
626
        );
627
628
        static::assertSame($gigyaResponse, $result);
629
    }
630
631
    public function testWillCallAValidator()
632
    {