Code Duplication    Length = 21-22 lines in 2 locations

Tests/Services/AzineTwigSwiftMailerTest.php 2 locations

@@ 366-386 (lines=21) @@
363
        $this->assertEquals(1, $sentCount, "One email should have been sent.");
364
    }
365
366
    public function testSendConfirmationEmailMessage()
367
    {
368
        $mocks = $this->getMockSetup(array($this, 'returnOne'));
369
        $user = $this->getUserMock();
370
371
        // as the subject from FOS-templates is embeded in the twig-template, the render-block is called 3 instead of only 2 times
372
        $mocks['baseTemplateMock']->expects($this->exactly(3))->method('renderBlock')->will($this->returnCallback(array($this, 'renderBlockCallback')));
373
374
        $mocks['parameters']['template'] = array();
375
        $mocks['parameters']['template']['confirmation'] = AzineTemplateProvider::FOS_USER_REGISTRATION_TEMPLATE.".txt.twig";
376
        $mocks['parameters']['from_email'] = array();
377
        $mocks['parameters']['from_email']['confirmation'] = '[email protected]';
378
379
        $mocks['router']->expects($this->once())->method('generate')->will($this->returnCallback(array($this, 'generateCallback')));
380
381
        $mocks['translator']->expects($this->exactly(2))->method('getLocale')->will($this->returnValue("en"));
382
383
        $azineMailer = new AzineTwigSwiftMailer($mocks['mailer'], $mocks['router'], $mocks['twig'], $mocks['logger'], $mocks['translator'], $mocks['templateProvider'], $mocks['entityManager'], $mocks['trackingCodeImgBuilder'], $mocks['parameters']);
384
385
        $azineMailer->sendConfirmationEmailMessage($user);
386
    }
387
388
    public function testSendResettingEmailMessage()
389
    {
@@ 388-409 (lines=22) @@
385
        $azineMailer->sendConfirmationEmailMessage($user);
386
    }
387
388
    public function testSendResettingEmailMessage()
389
    {
390
        $mocks = $this->getMockSetup(array($this, 'returnOne'));
391
        $user = $this->getUserMock();
392
393
        // as the subject from FOS-templates is embeded in the twig-template, the render-block is called 3 instead of only 2 times
394
        $mocks['baseTemplateMock']->expects($this->exactly(3))->method('renderBlock')->will($this->returnCallback(array($this, 'renderBlockCallback')));
395
396
        $mocks['parameters']['template'] = array();
397
        $mocks['parameters']['template']['resetting'] = AzineTemplateProvider::FOS_USER_PWD_RESETTING_TEMPLATE.".txt.twig";
398
        $mocks['parameters']['from_email'] = array();
399
        $mocks['parameters']['from_email']['resetting'] = '[email protected]';
400
401
        $mocks['translator']->expects($this->exactly(2))->method('getLocale')->will($this->returnValue("en"));
402
403
        $mocks['router']->expects($this->once())->method('generate')->will($this->returnCallback(array($this, 'generateCallback')));
404
405
        $azineMailer = new AzineTwigSwiftMailer($mocks['mailer'], $mocks['router'], $mocks['twig'], $mocks['logger'], $mocks['translator'], $mocks['templateProvider'], $mocks['entityManager'], $mocks['trackingCodeImgBuilder'], $mocks['parameters']);
406
407
        $azineMailer->sendResettingEmailMessage($user);
408
409
    }
410
}
411