diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2021-01-08 22:45:43 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-01-12 13:29:08 +0100 |
commit | f7b43501afa339dd11abca62c5e8eaa9a2c67d4e (patch) | |
tree | 4a2a7dd046e49a9225b54016c118f2103b05f837 /tests/Unit/Command | |
parent | 7cc22415a03889d5de3b90018bdc38ab2995e4f3 (diff) |
Fix nc 21 phpunit issue
Diffstat (limited to 'tests/Unit/Command')
-rw-r--r-- | tests/Unit/Command/ExploreGeneratorTest.php | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/Unit/Command/ExploreGeneratorTest.php b/tests/Unit/Command/ExploreGeneratorTest.php index ec04c4241..4482b91f3 100644 --- a/tests/Unit/Command/ExploreGeneratorTest.php +++ b/tests/Unit/Command/ExploreGeneratorTest.php @@ -26,22 +26,24 @@ use Favicon\Favicon; use FeedIo\Reader\Result; use OCA\News\Command\ExploreGenerator; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Test\TestCase; class ExploreGeneratorTest extends TestCase { - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var MockObject */ protected $favicon; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var MockObject */ protected $feedio; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var MockObject */ protected $consoleInput; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var MockObject */ protected $consoleOutput; - /** @var \Symfony\Component\Console\Command\Command */ + /** @var Command */ protected $command; protected function setUp(): void @@ -110,7 +112,8 @@ class ExploreGeneratorTest extends TestCase ->method('writeln') ->with($this->stringContains('https:\/\/feed.io\/rss.xml')); - self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $result = $this->command->run($this->consoleInput, $this->consoleOutput); + $this->assertSame(0, $result); } /** @@ -141,7 +144,8 @@ class ExploreGeneratorTest extends TestCase ->method('writeln') ->withConsecutive(['<error>Failed to fetch feed info:</error>'], ['Failure']); - self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $result = $this->command->run($this->consoleInput, $this->consoleOutput); + $this->assertSame(1, $result); } /** @@ -192,6 +196,7 @@ class ExploreGeneratorTest extends TestCase ->method('writeln') ->with($this->stringContains('200')); - self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $result = $this->command->run($this->consoleInput, $this->consoleOutput); + $this->assertSame(0, $result); } } |