mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Fixed tests failing with new typehints
This commit is contained in:
parent
5be5e0bc60
commit
863803b614
@ -7,6 +7,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Api\GenerateKeyCommand;
|
use Shlinkio\Shlink\CLI\Command\Api\GenerateKeyCommand;
|
||||||
|
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
use Symfony\Component\Console\Tester\CommandTester;
|
use Symfony\Component\Console\Tester\CommandTester;
|
||||||
@ -37,7 +38,8 @@ class GenerateKeyCommandTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function noExpirationDateIsDefinedIfNotProvided()
|
public function noExpirationDateIsDefinedIfNotProvided()
|
||||||
{
|
{
|
||||||
$this->apiKeyService->create(null)->shouldBeCalledTimes(1);
|
$this->apiKeyService->create(null)->shouldBeCalledTimes(1)
|
||||||
|
->willReturn(new ApiKey());
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
'command' => 'api-key:generate',
|
'command' => 'api-key:generate',
|
||||||
]);
|
]);
|
||||||
@ -46,9 +48,10 @@ class GenerateKeyCommandTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function expirationDateIsDefinedIfWhenProvided()
|
public function expirationDateIsDefinedIfProvided()
|
||||||
{
|
{
|
||||||
$this->apiKeyService->create(Argument::type(\DateTime::class))->shouldBeCalledTimes(1);
|
$this->apiKeyService->create(Argument::type(\DateTime::class))->shouldBeCalledTimes(1)
|
||||||
|
->willReturn(new ApiKey());
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
'command' => 'api-key:generate',
|
'command' => 'api-key:generate',
|
||||||
'--expirationDate' => '2016-01-01',
|
'--expirationDate' => '2016-01-01',
|
||||||
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Prophecy\MethodProphecy;
|
use Prophecy\Prophecy\MethodProphecy;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
@ -52,7 +53,7 @@ class CreateTagCommandTest extends TestCase
|
|||||||
{
|
{
|
||||||
$tagNames = ['foo', 'bar'];
|
$tagNames = ['foo', 'bar'];
|
||||||
/** @var MethodProphecy $createTags */
|
/** @var MethodProphecy $createTags */
|
||||||
$createTags = $this->tagService->createTags($tagNames)->willReturn([]);
|
$createTags = $this->tagService->createTags($tagNames)->willReturn(new ArrayCollection());
|
||||||
|
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
'--name' => $tagNames,
|
'--name' => $tagNames,
|
||||||
|
Loading…
Reference in New Issue
Block a user