Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/dev/1.7' into 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Banin committed Jul 8, 2015
2 parents 21a1967 + c9c73cc commit f86a959
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function tearDown()
}

$em->flush($entities);

parent::tearDown();
}

public function testResetChannelMetrics()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ public function getStatisticsRecord(EmailCampaign $emailCampaign, $entity)
->getMarketingListItem($marketingList, $entityId);

$manager = $this->doctrineHelper->getEntityManager($this->entityName);
$statisticsRecord = $manager->getRepository($this->entityName)
->findOneBy(['emailCampaign' => $emailCampaign, 'marketingListItem' => $marketingListItem]);

$statisticsRecord = null;
if ($marketingListItem->getId() !== null) {
$statisticsRecord = $manager->getRepository($this->entityName)
->findOneBy(['emailCampaign' => $emailCampaign, 'marketingListItem' => $marketingListItem]);
}

if (!$statisticsRecord) {
$statisticsRecord = new EmailCampaignStatistics();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public function testGetStatisticsRecordExisting($existing)
$marketingListItem = $this->getMockBuilder('OroCRM\Bundle\MarketingListBundle\Entity\MarketingListItem')
->disableOriginalConstructor()
->getMock();
$marketingListItem->expects($this->any())
->method('getId')
->willReturn(42);

$this->marketingListItemConnector->expects($this->once())
->method('getMarketingListItem')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ protected function tearDown()
$batchJobManager->createQuery('DELETE AkeneoBatchBundle:JobInstance')->execute();
$batchJobManager->createQuery('DELETE AkeneoBatchBundle:JobExecution')->execute();
$batchJobManager->createQuery('DELETE AkeneoBatchBundle:StepExecution')->execute();

parent::tearDown();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace OroCRM\Bundle\MagentoBundle\Tests\Functional\Controller;

use Doctrine\ORM\EntityManager;

use Oro\Bundle\ImportExportBundle\Job\JobExecutor;
use Oro\Bundle\ImportExportBundle\Job\JobResult;
use OroCRM\Bundle\MagentoBundle\Entity\NewsletterSubscriber;
Expand Down Expand Up @@ -66,6 +68,11 @@ protected function tearDown()

$this->getContainer()->set('oro_importexport.job_executor', $this->baseJobExecutor);
unset($this->transport, $this->baseJobExecutor);

$entityManager = $this->getContainer()->get('akeneo_batch.job_repository')->getJobManager();
$entityManager->getConnection()->close();

parent::tearDown();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Akeneo\Bundle\BatchBundle\Entity\JobExecution;

use Doctrine\ORM\EntityManager;
use Oro\Bundle\TestFrameworkBundle\Test\WebTestCase;
use OroCRM\Bundle\MagentoBundle\Provider\Transport\MagentoTransportInterface;

Expand All @@ -30,6 +31,9 @@ protected function setUp()
protected function tearDown()
{
$this->dropBatchJobs();
$this->closeConnections();

parent::tearDown();
}

protected function dropBatchJobs()
Expand All @@ -43,6 +47,14 @@ protected function dropBatchJobs()
unset($this->transport);
}

protected function closeConnections()
{
$entityManager = $this->getContainer()->get('akeneo_batch.job_repository')->getJobManager();
$entityManager
->getConnection()
->close();
}

/**
* @param string $alias
* @param string $status
Expand Down

0 comments on commit f86a959

Please sign in to comment.