-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add channel aware support for product provider (closes #2)
- Loading branch information
1 parent
1fe8e2d
commit dee0134
Showing
13 changed files
with
135 additions
and
25 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,20 +2,66 @@ | |
|
||
namespace Tests\SitemapPlugin\Controller; | ||
|
||
use Lakion\ApiTestCase\ApiTestCase; | ||
use Lakion\ApiTestCase\XmlApiTestCase; | ||
use Sylius\Component\Core\Model\Channel; | ||
use Sylius\Component\Core\Model\ChannelInterface; | ||
use Sylius\Component\Currency\Model\Currency; | ||
use Sylius\Component\Currency\Model\CurrencyInterface; | ||
use Sylius\Component\Locale\Model\Locale; | ||
use Sylius\Component\Locale\Model\LocaleInterface; | ||
|
||
/** | ||
* Class AbstractTestController | ||
* @package Tests\SitemapPlugin\Controller | ||
* @author Stefan Doorn <[email protected]> | ||
*/ | ||
abstract class AbstractTestController extends XmlApiTestCase | ||
{ | ||
/** | ||
* @var ChannelInterface | ||
*/ | ||
protected $channel; | ||
|
||
/** | ||
* @var LocaleInterface | ||
*/ | ||
protected $locale; | ||
|
||
/** | ||
* @var CurrencyInterface | ||
*/ | ||
protected $currency; | ||
|
||
/** | ||
* @before | ||
*/ | ||
public function setUpClient() | ||
public function setupDatabase() | ||
{ | ||
$this->client = static::createClient(array(), array()); | ||
parent::setUpDatabase(); | ||
|
||
$this->locale = new Locale(); | ||
$this->locale->setCode('en_US'); | ||
|
||
$this->getEntityManager()->persist($this->locale); | ||
|
||
$locale = new Locale(); | ||
$locale->setCode('nl_NL'); | ||
|
||
$this->getEntityManager()->persist($locale); | ||
|
||
$this->currency = new Currency(); | ||
$this->currency->setCode('USD'); | ||
|
||
$this->getEntityManager()->persist($this->currency); | ||
|
||
$this->channel = new Channel(); | ||
$this->channel->setCode('US_WEB'); | ||
$this->channel->setName('US Web Store'); | ||
$this->channel->setDefaultLocale($this->locale); | ||
$this->channel->setBaseCurrency($this->currency); | ||
$this->channel->setTaxCalculationStrategy('order_items_based'); | ||
|
||
$this->channel->addLocale($this->locale); | ||
|
||
$this->getEntityManager()->persist($this->channel); | ||
$this->getEntityManager()->flush(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
|
||
namespace Tests\SitemapPlugin\Controller; | ||
|
||
/** | ||
* @author Stefan Doorn <[email protected]> | ||
*/ | ||
trait RelativeClientTrait | ||
{ | ||
/** | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,10 @@ | |
|
||
namespace Tests\SitemapPlugin\Controller; | ||
|
||
use Sylius\Component\Core\Model\Channel; | ||
use Sylius\Component\Core\Model\Product; | ||
use Sylius\Component\Core\Model\ProductTranslation; | ||
use Sylius\Component\Locale\Model\Locale; | ||
|
||
/** | ||
* @author Stefan Doorn <[email protected]> | ||
|
@@ -27,6 +30,7 @@ public function setUpDatabase() | |
$product->setName('Test'); | ||
$product->setCode('test-code'); | ||
$product->setSlug('test'); | ||
$product->addChannel($this->channel); | ||
$this->getEntityManager()->persist($product); | ||
|
||
$product = new Product(); | ||
|
@@ -38,6 +42,7 @@ public function setUpDatabase() | |
$product->setName('Mock'); | ||
$product->setCode('mock-code'); | ||
$product->setSlug('mock'); | ||
$product->addChannel($this->channel); | ||
$this->getEntityManager()->persist($product); | ||
|
||
$product = new Product(); | ||
|
@@ -50,6 +55,19 @@ public function setUpDatabase() | |
$product->setCode('test-code-3'); | ||
$product->setSlug('test 2'); | ||
$product->setEnabled(false); | ||
$product->addChannel($this->channel); | ||
$this->getEntityManager()->persist($product); | ||
|
||
$product = new Product(); | ||
$product->setCurrentLocale('en_US'); | ||
$product->setName('Test 3'); | ||
$product->setCode('test-code-4'); | ||
$product->setSlug('test 3'); | ||
$product->setCurrentLocale('nl_NL'); | ||
$product->setName('Test 3'); | ||
$product->setCode('test-code-4'); | ||
$product->setSlug('test 3'); | ||
$product->setEnabled(false); | ||
$this->getEntityManager()->persist($product); | ||
|
||
$this->getEntityManager()->flush(); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
|
||
namespace Tests\SitemapPlugin\Controller; | ||
|
||
/** | ||
* @author Stefan Doorn <[email protected]> | ||
*/ | ||
trait TearDownTrait | ||
{ | ||
public function tearDown() | ||
|