1
0
mirror of synced 2024-11-25 06:16:06 +03:00
service-bundle/Tests/Messenger/CommandMessageTest.php
2021-03-31 11:00:48 +03:00

39 lines
1.5 KiB
PHP

<?php
namespace RetailCrm\ServiceBundle\Tests\Messenger;
use PHPUnit\Framework\TestCase;
use RetailCrm\ServiceBundle\Tests\DataFixtures\TestMessage;
/**
* Class CommandMessageTest
*
* @package RetailCrm\ServiceBundle\Tests\Messenger
*/
class CommandMessageTest extends TestCase
{
public function testMessage(): void
{
$message = new TestMessage();
static::assertEquals('test', $message->getCommandName());
static::assertEquals(['argument' => 'argument'], $message->getArguments());
static::assertEquals(['option' => 'option'], $message->getOptions());
static::assertEquals(['--option' => 'option'], $message->getFormattedOptions());
$message->addOption('option2', 'option2');
$message->addArgument('argument2', 'argument2');
static::assertEquals(['argument' => 'argument', 'argument2' => 'argument2'], $message->getArguments());
static::assertEquals(['option' => 'option', 'option2' => 'option2'], $message->getOptions());
static::assertEquals(['--option' => 'option', '--option2' => 'option2'], $message->getFormattedOptions());
$message->setOptions(['option' => 'option']);
$message->setArguments(['argument' => 'argument']);
static::assertEquals(['argument' => 'argument'], $message->getArguments());
static::assertEquals(['option' => 'option'], $message->getOptions());
static::assertEquals(['--option' => 'option'], $message->getFormattedOptions());
}
}