Skip to content

Commit

Permalink
Test DependencyGuesser::addGuesser.
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-perreal committed Dec 7, 2019
1 parent d85392b commit 41c4e5c
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

use ComposerRequireChecker\Cli\Options;
use ComposerRequireChecker\DependencyGuesser\DependencyGuesser;
use ComposerRequireChecker\DependencyGuesser\GuesserInterface;
use PhpParser\Node\Expr\ArrayItem;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\ArrayInput;

final class DependencyGuesserTest extends TestCase
{
Expand Down Expand Up @@ -43,4 +46,17 @@ public function testCoreExtensionsResolvesToPHP(): void
$this->assertNotEmpty($result);
$this->assertContains('php', $result);
}

public function testUseAddedGuesser(): void
{
$additionalGuesser = $this->createStub(GuesserInterface::class);
$additionalGuesser->method('__invoke')
->willReturnCallback(function (): \Generator {
yield 'additional-guesser-result';
});
$this->guesser->addGuesser($additionalGuesser);
$result = $this->guesser->__invoke('some_symbol');
$this->assertNotEmpty($result);
$this->assertContains('additional-guesser-result', $result);
}
}

0 comments on commit 41c4e5c

Please sign in to comment.