Skip to content

Commit

Permalink
Merge branch 'feature/ps-1131/master-pub-and-sync-re-export' of githu…
Browse files Browse the repository at this point in the history
…b.com:spryker/spryker into feature/ps-1131/master-pub-and-sync-re-export
  • Loading branch information
Ruslan05 committed Jul 20, 2018
2 parents 217f55b + 8023d25 commit 9f1e753
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Codeception\Test\Unit;
use Elastica\Exception\NotFoundException;
use PHPUnit\Framework\SkippedTestError;
use Spryker\Zed\AvailabilityStorage\Communication\Plugin\Synchronization\AvailabilitySynchronizationDataPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Synchronization\CategoryPageSynchronizationDataPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Synchronization\CategoryNodeSynchronizationDataPlugin;
Expand Down Expand Up @@ -65,6 +66,10 @@
*/
class SynchronizationFacadeTest extends Unit
{
protected const PARAM_PROJECT = 'PROJECT';

protected const PROJECT_SUITE = 'suite';

/**
* @var \Spryker\Zed\Synchronization\Business\SynchronizationFacadeInterface
*/
Expand Down Expand Up @@ -215,16 +220,22 @@ function ($key) {
}

/**
* @throws \PHPUnit\Framework\SkippedTestError
*
* @return void
*/
public function testExecuteResolvedPluginsBySources()
{
if (!$this->isSuiteProject()) {
throw new SkippedTestError('Warning: not in suite environment');
}

$container = new Container();
$container[SynchronizationDependencyProvider::CLIENT_QUEUE] = function (Container $container) {
$queueMock = $this->createQueueClientBridge();
$synchronizationPlugins = $this->createSynchronizationDataPlugins();

if (count($synchronizationPlugins)) {
if (count($synchronizationPlugins) && $this->isSuiteProject()) {
$queueMock->expects($this->atLeastOnce())->method('sendMessages');
return $queueMock;
}
Expand All @@ -242,6 +253,18 @@ public function testExecuteResolvedPluginsBySources()
$this->synchronizationFacade->executeResolvedPluginsBySources([]);
}

/**
* @return bool
*/
public function isSuiteProject(): bool
{
if (getenv(static::PARAM_PROJECT) === static::PROJECT_SUITE) {
return true;
}

return false;
}

/**
* @return \PHPUnit_Framework_MockObject_MockObject
*/
Expand Down

0 comments on commit 9f1e753

Please sign in to comment.