Skip to content
This repository has been archived by the owner on May 30, 2019. It is now read-only.

Commit

Permalink
Fixed tests that were failing
Browse files Browse the repository at this point in the history
* All tests work as expected
  • Loading branch information
mmoreram committed Jun 14, 2015
1 parent 6a8bcc8 commit 58fad92
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Elcodi/Bridge/BehatBridgeBundle/DoctrineContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function loadCommonFixtures()
->getRootDir();

$command =
'doc:fix:load ' .
'doctrine:fixtures:load ' .
'--fixtures=' . $rootDir . '/../src/Elcodi/Plugin/ ' .
'--fixtures=' . $rootDir . '/../src/Elcodi/Fixtures ' .
'--env=test ' .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

namespace Elcodi\Bridge\VisithorBridgeBundle\Environment;

use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\HttpKernel\KernelInterface;
use Visithor\Bundle\Environment\SymfonyEnvironmentBuilder;

use Elcodi\Component\Geo\Entity\Interfaces\LocationInterface;
use Elcodi\Component\User\Repository\AdminUserRepository;
use Elcodi\Component\User\Repository\CustomerRepository;

Expand Down Expand Up @@ -68,11 +70,8 @@ public function setUp(KernelInterface $kernel)
parent::setUp($kernel);

$this
->executeCommand('doctrine:fixtures:load', [
'--no-booster' => true,
'--fixtures' => $kernel
->getRootDir() . '/../src/Elcodi/Fixtures',
])
->loadCommonFixtures($kernel)
->loadLocationFixtures($kernel)
->executeCommand('elcodi:plugins:load');
}

Expand All @@ -97,4 +96,92 @@ public function getAuthenticationUser($role)
'email' => 'customer@customer.com',
]);
}

/**
* Load common fixtures
*
* @param KernelInterface $kernel Kernel
*
* @return $this Self object
*/
private function loadCommonFixtures(KernelInterface $kernel)
{
$rootDir = $kernel->getRootDir();

$command =
'doctrine:fixtures:load ' .
'--fixtures=' . $rootDir . '/../src/Elcodi/Plugin/ ' .
'--fixtures=' . $rootDir . '/../src/Elcodi/Fixtures ' .
'--env=test ' .
'--no-interaction ' .
'--quiet ';

$input = new StringInput($command);
$this
->application
->run($input);

return $this;
}

/**
* Load location fixtures
*
* @return $this Self object
*/
private function loadLocationFixtures(KernelInterface $kernel)
{
$locationDirector = $kernel
->getContainer()
->get('elcodi.director.location');

/**
* @var LocationInterface $locationBarcelonaCity
*/
$locationBarcelonaCity = $locationDirector
->create()
->setId('ES_CT_B_Barcelona')
->setName('Barcelona')
->setCode('Barcelona')
->setType('city');
$locationDirector->save($locationBarcelonaCity);

/**
* @var LocationInterface $locationBarcelonaProvince
*/
$locationBarcelonaProvince = $locationDirector
->create()
->setId('ES_CT_B')
->setName('Barcelona')
->setCode('B')
->setType('province')
->addChildren($locationBarcelonaCity);
$locationDirector->save($locationBarcelonaProvince);

/**
* @var LocationInterface $locationCatalunya
*/
$locationCatalunya = $locationDirector
->create()
->setId('ES_CT')
->setName('Catalunya')
->setCode('CT')
->setType('state')
->addChildren($locationBarcelonaProvince);
$locationDirector->save($locationCatalunya);

/**
* @var LocationInterface $locationSpain
*/
$locationSpain = $locationDirector
->create()
->setId('ES')
->setName('Spain')
->setCode('ES')
->setType('country')
->addChildren($locationCatalunya);
$locationDirector->save($locationSpain);

return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ elcodi_plugin:
field:
business:
label: Paypal account
placeholder: john@doo.com
placeholder: john@doo.com
5 changes: 1 addition & 4 deletions visithor.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,7 @@ urls:
#
# Miscelania
#
- [admin_configuration_list, 200, {profile: admin}]
- [admin_homepage, 302, {profile: admin}]
- [admin_payment_configuration_list, 200, {profile: admin}]
- [admin_homepage, 200, {profile: admin}]
- [admin_template_list, 200, {profile: admin}]
- [admin_plugin_list, 200, {profile: admin}]
- [admin_store_setup_wizard, 200, {profile: admin}]

0 comments on commit 58fad92

Please sign in to comment.