Completed
Pull Request — master (#25)
by
unknown
04:55
created

TestHelper::addSentEmails()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 11
nc 2
nop 2
1
<?php
2
namespace Azine\EmailBundle\Tests;
3
4
use Azine\EmailBundle\Entity\SentEmail;
5
use Azine\EmailBundle\Services\AzineTemplateProvider;
6
use Doctrine\ORM\EntityManager;
7
8
class TestHelper
9
{
10
    /**
11
     * @param integer $count
12
     */
13
    public static function addSentEmails(EntityManager $manager, $count)
14
    {
15
        while ($count > 0) {
16
            $sentEmail = new SentEmail();
17
            $sentEmail->setRecipients(array('[email protected]'));
18
            $sentEmail->setSent(new \DateTime("2 weeks ago"));
19
            $sentEmail->setTemplate(AzineTemplateProvider::NEWSLETTER_TEMPLATE);
20
            $sentEmail->setVariables(array());
21
            $sentEmail->setToken('fdasdfasfafsadf');
22
            $manager->persist($sentEmail);
23
24
            $count--;
25
        }
26
        $manager->flush();
27
    }
28
 }
29