-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2118ef7
commit 4e250f9
Showing
10 changed files
with
425 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\AdminBundle\Tests\Block; | ||
|
||
use Sonata\AdminBundle\Admin\Pool; | ||
use Sonata\AdminBundle\Block\AdminListBlockService; | ||
use Sonata\AdminBundle\Templating\TemplateRegistryInterface; | ||
use Sonata\AdminBundle\Tests\Fixtures\Block\FakeBlockService; | ||
use Sonata\BlockBundle\Test\BlockServiceTestCase; | ||
use Twig\Environment; | ||
|
||
/** | ||
* NEXT_MAJOR: Remove this class. | ||
* | ||
* @group legacy | ||
* | ||
* @author Sullivan Senechal <[email protected]> | ||
*/ | ||
class DeprecatedAdminListBlockServiceTest extends BlockServiceTestCase | ||
{ | ||
/** | ||
* @var Pool | ||
*/ | ||
private $pool; | ||
|
||
/** | ||
* @var TemplateRegistryInterface | ||
*/ | ||
private $templateRegistry; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->pool = $this->createMock(Pool::class); | ||
|
||
$this->templateRegistry = $this->prophesize(TemplateRegistryInterface::class); | ||
} | ||
|
||
/** | ||
* @expectedDeprecation Passing null as argument 2 to Sonata\AdminBundle\Block\AdminListBlockService::__construct() is deprecated since sonata-project/admin-bundle 3.x and will throw a \TypeError in version 4.0. You must pass an instance of Sonata\AdminBundle\Admin\Pool instead. | ||
*/ | ||
public function testDefaultSettings(): void | ||
{ | ||
$blockService = new AdminListBlockService( | ||
$this->createMock(Environment::class), | ||
null, | ||
$this->pool, | ||
$this->templateRegistry->reveal() | ||
); | ||
$blockContext = $this->getBlockContext($blockService); | ||
|
||
$this->assertSettings([ | ||
'groups' => false, | ||
], $blockContext); | ||
} | ||
|
||
/** | ||
* @expectedDeprecation Passing null as argument 2 to Sonata\AdminBundle\Block\AdminListBlockService::__construct() is deprecated since sonata-project/admin-bundle 3.x and will throw a \TypeError in version 4.0. You must pass an instance of Sonata\AdminBundle\Admin\Pool instead. | ||
*/ | ||
public function testOverriddenDefaultSettings(): void | ||
{ | ||
$blockService = new FakeBlockService( | ||
$this->createMock(Environment::class), | ||
null, | ||
$this->pool, | ||
$this->templateRegistry->reveal() | ||
); | ||
$blockContext = $this->getBlockContext($blockService); | ||
|
||
$this->assertSettings([ | ||
'foo' => 'bar', | ||
'groups' => true, | ||
], $blockContext); | ||
} | ||
} |
Oops, something went wrong.