init
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Test\Unit\Plugin\Blog;
|
||||
|
||||
use Esun\MultiLocaleTranslation\Model\BlogPostTranslationApplier;
|
||||
use Esun\MultiLocaleTranslation\Plugin\Blog\ApplyStoreTranslationToPostCollection;
|
||||
use Mageplaza\Blog\Model\ResourceModel\Post\Collection;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ApplyStoreTranslationToPostCollectionTest extends TestCase
|
||||
{
|
||||
public function testNestedLoadDoesNotApplyCollectionTwice(): void
|
||||
{
|
||||
$collection = $this->createMock(Collection::class);
|
||||
$applier = $this->createMock(BlogPostTranslationApplier::class);
|
||||
$plugin = new ApplyStoreTranslationToPostCollection($applier);
|
||||
|
||||
$collection->expects(self::once())->method('getItems')->willReturnCallback(
|
||||
function () use ($plugin, $collection): array {
|
||||
$plugin->afterLoad($collection, $collection);
|
||||
return [];
|
||||
}
|
||||
);
|
||||
$applier->expects(self::once())->method('applyMany')->with([]);
|
||||
|
||||
self::assertSame($collection, $plugin->afterLoad($collection, $collection));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user