Skip to content

Commit

Permalink
Fixes test
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Jul 12, 2020
1 parent 9d7f50e commit d0cfb47
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
8 changes: 0 additions & 8 deletions src/Collection.php
Expand Up @@ -175,12 +175,4 @@ public function getByName(string $packageName): Package

throw new Exception("Package \"{$packageName} ({$packageAlias})\" not found in collection");
}

/**
* @return Package[]
*/
public function getAll(): array
{
return $this->collection;
}
}
1 change: 1 addition & 0 deletions src/Helper.php
Expand Up @@ -27,6 +27,7 @@ class Helper

/**
* @return string|null
* @codeCoverageIgnore
* @phan-suppress PhanUnusedVariableCaughtException
*/
public static function getGitVersion(): ?string
Expand Down
8 changes: 0 additions & 8 deletions src/Package.php
Expand Up @@ -187,14 +187,6 @@ public function isMain(): bool
return $this->isTag(self::MAIN);
}

/**
* @return bool
*/
public function isSuggest(): bool
{
return $this->isTag(self::SUGGEST);
}

/**
* @param bool $addVersion
* @return string
Expand Down
28 changes: 26 additions & 2 deletions tests/GraphBuildTest.php
Expand Up @@ -15,6 +15,11 @@

namespace JBZoo\PHPUnit;

use JBZoo\ComposerGraph\Collection;
use JBZoo\ComposerGraph\ComposerGraph;

use function JBZoo\Data\json;

/**
* Class GraphBuildTest
*
Expand Down Expand Up @@ -739,7 +744,7 @@ public function testJBZooToolboxNoDev()

public function testRealProject()
{
isSame(implode("\n", [
$excepted = implode("\n", [
'graph LR;',
' amphp__byte_stream-->amphp__amp;',
' codedungeon__phpunit_result_printer-->2bj__phanybar;',
Expand Down Expand Up @@ -1132,10 +1137,29 @@ public function testRealProject()
' webmozart__path_util("webmozart/path-util");',
' zendframework__zend_httphandlerrunner(["zendframework/zend-httphandlerrunner"]);',
' end',
]), $this->buildGraph([
]);

isSame($excepted, $this->buildGraph([
'show-dev' => null,
'show-suggests' => null,
], __FUNCTION__));

$composerJson = json(PROJECT_ROOT . '/tests/fixtures/testJBZooToolbox/composer.json');
$composerLock = json(PROJECT_ROOT . '/tests/fixtures/testJBZooToolbox/composer.lock');

$collection = new Collection($composerJson, $composerLock);

$result = (new ComposerGraph($collection, [
'php' => false,
'ext' => false,
'dev' => true,
'suggest' => true,
'link-version' => false,
'lib-version' => false,
'format' => ComposerGraph::FORMAT_MERMAID,
]))->build();

isSame($excepted, $result);
}

public function testRealProjectMinimal()
Expand Down

0 comments on commit d0cfb47

Please sign in to comment.