Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Remove deprecations from PHPUnit 9
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Oct 22, 2020
1 parent 3b2bc03 commit 568122f
Showing 1 changed file with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
* file that was distributed with this source code.
*/

namespace Sonata\Tests\Action;
namespace Sonata\NewsBundle\Tests\Action;

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Sonata\DatagridBundle\Pager\PagerInterface;
use Sonata\IntlBundle\Templating\Helper\DateTimeHelper;
use Sonata\NewsBundle\Action\DailyPostArchiveAction;
Expand All @@ -30,9 +29,9 @@ class DailyPostArchiveActionTest extends TestCase
{
public function testInvoke()
{
$blog = $this->prophesize(BlogInterface::class);
$translator = $this->prophesize(TranslatorInterface::class);
$dateTimeHelper = $this->prophesize(DateTimeHelper::class);
$blog = $this->createStub(BlogInterface::class);
$translator = $this->createStub(TranslatorInterface::class);
$dateTimeHelper = $this->createStub(DateTimeHelper::class);

$dataParams = [
'query' => 'foo.publicationDateStart >= :startDate AND bar.publicationDateStart < :endDate',
Expand All @@ -42,26 +41,24 @@ public function testInvoke()
],
];

$postManager = $this->prophesize(PostManager::class);
$postManager->getPublicationDateQueryParts('2018-7-8', 'day')
$postManager = $this->createStub(PostManager::class);
$postManager->method('getPublicationDateQueryParts')->with('2018-7-8', 'day')
->willReturn($dataParams);
$postManager->getPager([
'date' => $dataParams,
], 1)
->willReturn($this->prophesize(PagerInterface::class));
$postManager->method('getPager')->with(['date' => $dataParams], 1)
->willReturn($this->createStub(PagerInterface::class));

$twig = $this->prophesize(Environment::class);
$twig->render('@SonataNews/Post/archive.html.twig', Argument::any())
$twig = $this->createStub(Environment::class);
$twig->method('render')->with('@SonataNews/Post/archive.html.twig', $this->anything())
->willReturn('HTML CONTENT');

$container = new Container();
$container->set('twig', $twig->reveal());
$container->set('twig', $twig);

$action = new DailyPostArchiveAction(
$blog->reveal(),
$postManager->reveal(),
$translator->reveal(),
$dateTimeHelper->reveal()
$blog,
$postManager,
$translator,
$dateTimeHelper
);
$action->setContainer($container);

Expand Down

0 comments on commit 568122f

Please sign in to comment.