diff options
Diffstat (limited to 'tests/Unit/Command/ExploreGeneratorTest.php')
-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); } } |