Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Smetannikov committed Jul 3, 2020
1 parent f028def commit b8f7634
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 1,849 deletions.
21 changes: 21 additions & 0 deletions Makefile
Expand Up @@ -27,3 +27,24 @@ test-all: ##@Project Run all project tests at once
@make test
@-make report-merge-coverage
@make codestyle


test-real:
@php `pwd`/jbzoo-composer-graph build \
--composer-json=`pwd`/tests/fixtures/testRealProject/composer.json \
--composer-lock=`pwd`/tests/fixtures/testRealProject/composer.lock \
--output=$(PATH_BUILD)/manual-test.html \
--link-version=false \
--lib-version=false \
--no-php \
--no-ext \
-vvv
@php `pwd`/jbzoo-composer-graph build \
--composer-json=`pwd`/tests/fixtures/testRealProject/composer.json \
--composer-lock=`pwd`/tests/fixtures/testRealProject/composer.lock \
--output=$(PATH_BUILD)/manual-test-platform.html \
--link-version=false \
--lib-version=false \
--no-php \
--no-dev \
-vvv
13 changes: 10 additions & 3 deletions src/ComposerGraph.php
Expand Up @@ -118,7 +118,8 @@ public function build(): string

$htmlPath = $this->params->get('output-path');
file_put_contents($htmlPath, $this->graphWrapper->renderHtml([
'title' => $main->getName() . ' - Graph of Dependencies',
'version' => '8.5.2',
'title' => $main->getName() . ' - Graph of Dependencies',
]));

return $htmlPath;
Expand Down Expand Up @@ -207,12 +208,18 @@ private function addLink(Package $source, Package $target, string $version, Grap
$sourceNode = $this->createNode($source);
$targetNode = $this->createNode($target);

$arrow = $source->isMain() && $target->isDirectPackage() ? Link::THICK : Link::DOTTED;
if (!$this->params->get('link-version')) {
$version = '';
}

$graph->addLink(new Link($sourceNode, $targetNode, $version, $arrow));
if ($source->isMain() && $target->isDirectPackage()) {
$graph->addLink(new Link($sourceNode, $targetNode, $version, Link::THICK));
} elseif ($source->isMain() && $target->isDirectPackageDev()) {
$graph->addLink(new Link($sourceNode, $targetNode, $version, Link::ARROW));
} else {
$graph->addLink(new Link($sourceNode, $targetNode, $version, Link::DOTTED));
}

$createdLinks[$pattern] = true;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/GraphBuildTest.php
Expand Up @@ -187,7 +187,7 @@ public function testComplex()
' end',
' subgraph "Required Dev"',
' b639e1b42e0f7a49ac0e6eec145977b3("jbzoo/event@3.0.x-dev");',
' a21583cedf3174136523a39c2b1c715b-. "3.0.x-dev" .-> b639e1b42e0f7a49ac0e6eec145977b3;',
' a21583cedf3174136523a39c2b1c715b-->|"3.0.x-dev"|b639e1b42e0f7a49ac0e6eec145977b3;',
' end',
' subgraph "PHP Platform"',
' 4d48b207cdf39d7efea6cb77e287a47d("ext-json");',
Expand Down
6 changes: 5 additions & 1 deletion tests/fixtures/testRealProject/composer.json
Expand Up @@ -18,7 +18,11 @@
"require-dev" : {
"jbzoo/phpunit" : "4.0.x-dev",
"jbzoo/codestyle" : "2.0.x-dev",
"roave/security-advisories" : "dev-master"
"jbzoo/composer-graph" : "1.0.x-dev",
"roave/security-advisories" : "dev-master",

"guzzlehttp/guzzle" : "^6.4.1",
"rmccue/requests" : "^1.7.0"
},

"minimum-stability" : "dev",
Expand Down

0 comments on commit b8f7634

Please sign in to comment.