Skip to content

Commit

Permalink
Don't reload oxrun command ageain.
Browse files Browse the repository at this point in the history
  • Loading branch information
TumTum committed Mar 23, 2019
1 parent fc9a101 commit 765d6fa
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/Oxrun/CommandCollection/Aggregator/CommunityPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ class CommunityPass extends Aggregator
*/
protected $installed_json = '/composer/installed.json';

/**
* @var array
*/
protected $ignorePackage = [
'oxidprojects/oxrun'
];

/**
* @inheritDoc
*/
Expand Down Expand Up @@ -80,7 +87,13 @@ protected function findServicesYaml()
$packages = $localRepository->getPackages();

foreach ($packages as $package) {
$serviceFile = $oxid_vendor . $package->getName() . '/services.yaml';
$package_name = $package->getName();

if (in_array($package_name, $this->ignorePackage)) {
continue;
}

$serviceFile = $oxid_vendor . $package_name . '/services.yaml';
if (file_exists($serviceFile)) {
CacheCheck::addFile($serviceFile);
$loader->load($serviceFile);
Expand Down
26 changes: 25 additions & 1 deletion tests/Oxrun/CommandCollection/Aggregator/CommunityPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Oxrun\CommandCollection\Aggregator;
use Oxrun\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Prophecy\ObjectProphecy;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand All @@ -33,7 +34,7 @@ class CommunityPassTest extends TestCase
private $containerBuilder;

/**
* @var Definition|ObjectProphecy
* @var Definition|ObjectProphecy|MethodProphecy
*/
private $definition;

Expand Down Expand Up @@ -95,6 +96,29 @@ public function testCheckCacheFiles()
$this->assertCount(2, $actual);
}

public function testDontLoadOxrunCommands()
{
//Arrange
$oxid_fs['vendor']['composer']['installed.json'] = file_get_contents(self::getTestData('installed_oxrun_package.json'));
$oxid_fs['vendor']['oxidprojects']['oxrun']['services.yaml'] = file_get_contents(self::getTestData('service_yml/standard.yml'));

$oxid_fs_source = $this->fillShopDir($oxid_fs)->getVfsStreamUrl();

$communityPass = new Aggregator\CommunityPass();
$communityPass->setShopDir($oxid_fs_source);


$this->definition->addMethodCall(Argument::is('addFromDi'), Argument::any())->shouldNotBeCalled();

//Act
$communityPass->process($this->containerBuilder);

$actual = CacheCheck::getResource();

//Assert
$this->assertCount(1, $actual);
}

protected function setUp()
{
$this->mockShopDir();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[
{
"name": "oxidprojects/oxrun",
"version": "4.0.0-beta.2",
"version_normalized": "4.0.0.0-beta2",
"source": {
"type": "git",
"url": "https://github.com/OXIDprojects/oxrun.git",
"reference": "c9e99cd588c63bf997d1d0d98c83453bdf7e4f97"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/OXIDprojects/oxrun/zipball/c9e99cd588c63bf997d1d0d98c83453bdf7e4f97",
"reference": "c9e99cd588c63bf997d1d0d98c83453bdf7e4f97",
"shasum": ""
},
"require": {
"composer/composer": "^1",
"guzzlehttp/guzzle": "^6.0",
"raulfraile/distill": "0.9.*",
"symfony/config": "^3",
"symfony/console": "^2",
"symfony/dependency-injection": "^3",
"symfony/finder": "^2",
"symfony/yaml": "^2"
},
"require-dev": {
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2",
"phpunit/phpunit": "^6",
"symfony/var-dumper": "^3"
},
"suggest": {
"oxid-community/moduleinternals": "To has more command",
"oxid-professional-services/oxid-console": "a other console cli"
},
"time": "2019-03-20T13:03:07+00:00",
"bin": [
"bin/oxrun"
],
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"": [
"src",
"tests"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [],
"description": "Oxrun provides a cli toolset for the OXID eShop v6.x",
"homepage": "https://github.com/oxidprojects/oxrun",
"keywords": [
"OXID",
"cli",
"installer"
]
}
]

0 comments on commit 765d6fa

Please sign in to comment.