-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/dev/1.4' into 1.4
- Loading branch information
Showing
10 changed files
with
343 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/Oro/Bundle/IntegrationBundle/Tests/Functional/DataFixtures/LoadChannelData.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace Oro\Bundle\IntegrationBundle\Tests\Functional\DataFixtures; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
use Oro\Bundle\IntegrationBundle\Entity\Channel as Integration; | ||
use Oro\Bundle\UserBundle\Migrations\Data\ORM\LoadAdminUserData; | ||
|
||
class LoadChannelData extends AbstractFixture implements ContainerAwareInterface | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
protected $container; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $data = [ | ||
[ | ||
'name' => 'Foo Integration', | ||
'type' => 'foo', | ||
'enabled' => true, | ||
'reference' => 'oro_integration:foo_integration' | ||
], | ||
[ | ||
'name' => 'Bar Integration', | ||
'type' => 'bar', | ||
'enabled' => true, | ||
'reference' => 'oro_integration:bar_integration' | ||
] | ||
]; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setContainer(ContainerInterface $container = null) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(ObjectManager $manager) | ||
{ | ||
$userManager = $this->container->get('oro_user.manager'); | ||
$admin = $userManager->findUserByEmail(LoadAdminUserData::DEFAULT_ADMIN_EMAIL); | ||
|
||
foreach ($this->data as $data) { | ||
$integration = new Integration(); | ||
|
||
$integration->setName($data['name']); | ||
$integration->setType($data['type']); | ||
$integration->setEnabled($data['enabled']); | ||
$integration->setDefaultUserOwner($admin); | ||
$integration->setOrganization($admin->getOrganization()); | ||
|
||
$this->setReference($data['reference'], $integration); | ||
|
||
$manager->persist($integration); | ||
} | ||
|
||
$manager->flush(); | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
src/Oro/Bundle/IntegrationBundle/Tests/Functional/DataFixtures/LoadStatusData.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
|
||
namespace Oro\Bundle\IntegrationBundle\Tests\Functional\DataFixtures; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\DataFixtures\DependentFixtureInterface; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
use Oro\Bundle\IntegrationBundle\Entity\Status; | ||
|
||
class LoadStatusData extends AbstractFixture implements ContainerAwareInterface, DependentFixtureInterface | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
protected $container; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $data = [ | ||
[ | ||
'channel' => 'oro_integration:foo_integration', | ||
'status' => Status::STATUS_COMPLETED, | ||
'connector' => 'first_connector', | ||
'date' => '2015-02-01 00:00:00', | ||
'message' => '', | ||
'reference' => 'oro_integration:foo_first_connector_first_status_completed' | ||
], | ||
[ | ||
'channel' => 'oro_integration:foo_integration', | ||
'status' => Status::STATUS_COMPLETED, | ||
'connector' => 'first_connector', | ||
'date' => '2015-02-01 00:05:00', | ||
'message' => '', | ||
'reference' => 'oro_integration:foo_first_connector_second_status_completed' | ||
], | ||
[ | ||
'channel' => 'oro_integration:foo_integration', | ||
'status' => Status::STATUS_FAILED, | ||
'connector' => 'first_connector', | ||
'date' => '2015-02-01 00:10:00', | ||
'message' => '', | ||
'reference' => 'oro_integration:foo_first_connector_third_status_failed' | ||
], | ||
[ | ||
'channel' => 'oro_integration:foo_integration', | ||
'status' => Status::STATUS_COMPLETED, | ||
'connector' => 'second_connector', | ||
'date' => '2015-02-01 00:15:00', | ||
'message' => '', | ||
'reference' => 'oro_integration:foo_second_connector_first_status_completed' | ||
], | ||
[ | ||
'channel' => 'oro_integration:bar_integration', | ||
'status' => Status::STATUS_COMPLETED, | ||
'connector' => 'first_connector', | ||
'date' => '2015-02-01 00:20:00', | ||
'message' => '', | ||
'reference' => 'oro_integration:bar_first_connector_first_status_completed' | ||
], | ||
]; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setContainer(ContainerInterface $container = null) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(ObjectManager $manager) | ||
{ | ||
foreach ($this->data as $data) { | ||
$status = new Status(); | ||
$status->setChannel($this->getReference($data['channel'])); | ||
$status->setCode($data['status']); | ||
$status->setConnector($data['connector']); | ||
$status->setDate(new \DateTime($data['date'], new \DateTimeZone('UTC'))); | ||
$status->setMessage($data['message']); | ||
|
||
$this->setReference($data['reference'], $status); | ||
|
||
$manager->persist($status); | ||
} | ||
|
||
$manager->flush(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getDependencies() | ||
{ | ||
return [ | ||
'Oro\Bundle\IntegrationBundle\Tests\Functional\DataFixtures\LoadChannelData' | ||
]; | ||
} | ||
} |
Oops, something went wrong.