Skip to content

Commit

Permalink
UHF-10844: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Oct 28, 2024
1 parent 275cee0 commit 74e1c33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions tests/src/Unit/Commands/PubSubCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
use Drupal\helfi_api_base\Azure\PubSub\PubSubManagerInterface;
use Drupal\helfi_api_base\Drush\Commands\PubSubCommands;
use Drush\Commands\DrushCommands;
use Drush\Style\DrushStyle;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use WebSocket\ConnectionException;
use WebSocket\TimeoutException;

Expand All @@ -31,7 +31,7 @@ public function testListen() : void {
$expectedMessage = '{"message":"test"}';
$output = $this->prophesize(OutputInterface::class);
$input = $this->prophesize(InputInterface::class);
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln(Argument::containingString('Received message'))
->shouldBeCalledTimes(PubSubCommands::MAX_MESSAGES);
$io->writeln(Argument::containingString('Received maximum number of messages'))
Expand All @@ -51,7 +51,7 @@ public function testListen() : void {
public function testExceptionOutput() : void {
$output = $this->prophesize(OutputInterface::class);
$input = $this->prophesize(InputInterface::class);
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln('Invalid json: Syntax error')->shouldBeCalledTimes(PubSubCommands::MAX_MESSAGES);
$io->writeln(Argument::containingString('Received maximum number of messages'))
->shouldBeCalledTimes(1);
Expand All @@ -70,7 +70,7 @@ public function testExceptionOutput() : void {
public function testTimeoutException() : void {
$output = $this->prophesize(OutputInterface::class);
$input = $this->prophesize(InputInterface::class);
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln(Argument::containingString('Received maximum number of messages'))
->shouldBeCalledTimes(1);

Expand Down
10 changes: 5 additions & 5 deletions tests/src/Unit/Commands/RevisionCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
use Drupal\helfi_api_base\Commands\RevisionCommands;
use Drupal\helfi_api_base\Entity\Revision\RevisionManager;
use Drush\Commands\DrushCommands;
use Drush\Style\DrushStyle;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
* Tests revision commands.
Expand Down Expand Up @@ -114,7 +114,7 @@ private function getConnectionMock(array $expected, ?int $id = NULL) : Connectio
* Test command with invalid entity type.
*/
public function testInvalidEntityType() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln(Argument::containingString('Given entity type is not supported.'))
->shouldBeCalled();

Expand All @@ -130,7 +130,7 @@ public function testInvalidEntityType() : void {
* Test delete without any entities.
*/
public function testNoEntities() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->isDecorated()
->willReturn(TRUE);
$io->getVerbosity()
Expand All @@ -148,7 +148,7 @@ public function testNoEntities() : void {
* Tests delete method with proper data.
*/
public function testDelete() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->isDecorated()
->willReturn(TRUE);
$io->getVerbosity()
Expand All @@ -170,7 +170,7 @@ public function testDelete() : void {
* Tests delete method with optional ID.
*/
public function testDeleteWithId() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->isDecorated()
->willReturn(TRUE);
$io->getVerbosity()
Expand Down

0 comments on commit 74e1c33

Please sign in to comment.