|
| 1 | +<?php |
| 2 | +/************************************************************************ |
| 3 | + * |
| 4 | + * Copyright 2023 Adobe |
| 5 | + * All Rights Reserved. |
| 6 | + * |
| 7 | + * NOTICE: All information contained herein is, and remains |
| 8 | + * the property of Adobe and its suppliers, if any. The intellectual |
| 9 | + * and technical concepts contained herein are proprietary to Adobe |
| 10 | + * and its suppliers and are protected by all applicable intellectual |
| 11 | + * property laws, including trade secret and copyright laws. |
| 12 | + * Dissemination of this information or reproduction of this material |
| 13 | + * is strictly forbidden unless prior written permission is obtained |
| 14 | + * from Adobe. |
| 15 | + * ************************************************************************ |
| 16 | + */ |
| 17 | +declare(strict_types=1); |
| 18 | + |
| 19 | +namespace Magento\Framework\Test\Unit\Mview\View\ChangelogBatchWalker; |
| 20 | + |
| 21 | +use Magento\Framework\App\ResourceConnection; |
| 22 | +use Magento\Framework\DB\Adapter\AdapterInterface; |
| 23 | +use Magento\Framework\DB\Ddl\Table; |
| 24 | +use Magento\Framework\Mview\View\ChangelogBatchWalker\IdsTableBuilder; |
| 25 | +use Magento\Framework\Mview\View\ChangelogInterface; |
| 26 | +use PHPUnit\Framework\TestCase; |
| 27 | + |
| 28 | +class IdsTableBuilderTest extends TestCase |
| 29 | +{ |
| 30 | + /** |
| 31 | + * @var ResourceConnection |
| 32 | + */ |
| 33 | + private $resourceConnection; |
| 34 | + |
| 35 | + /** |
| 36 | + * @var ChangelogInterface |
| 37 | + */ |
| 38 | + private $changeLog; |
| 39 | + |
| 40 | + /** |
| 41 | + * @var AdapterInterface |
| 42 | + */ |
| 43 | + private $connection; |
| 44 | + |
| 45 | + /** |
| 46 | + * @var Table |
| 47 | + */ |
| 48 | + private $table; |
| 49 | + |
| 50 | + /** |
| 51 | + * @var IdsTableBuilder |
| 52 | + */ |
| 53 | + private $model; |
| 54 | + |
| 55 | + protected function setUp(): void |
| 56 | + { |
| 57 | + $this->changeLog = $this->getMockBuilder(ChangelogInterface::class) |
| 58 | + ->getMockForAbstractClass(); |
| 59 | + $this->connection = $this->getMockBuilder(AdapterInterface::class) |
| 60 | + ->getMockForAbstractClass(); |
| 61 | + $this->table = $this->getMockBuilder(Table::class) |
| 62 | + ->disableOriginalConstructor() |
| 63 | + ->getMock(); |
| 64 | + |
| 65 | + $this->resourceConnection = $this->getMockBuilder(ResourceConnection::class) |
| 66 | + ->disableOriginalConstructor() |
| 67 | + ->getMock(); |
| 68 | + $this->resourceConnection->expects($this->any()) |
| 69 | + ->method('getConnection') |
| 70 | + ->willReturn($this->connection); |
| 71 | + $this->connection->expects($this->any()) |
| 72 | + ->method('newTable') |
| 73 | + ->willReturn($this->table); |
| 74 | + |
| 75 | + $this->model = new IdsTableBuilder($this->resourceConnection); |
| 76 | + } |
| 77 | + |
| 78 | + public function testBuildDoNotCreateMemoryTable() : void |
| 79 | + { |
| 80 | + $this->table->expects($this->never()) |
| 81 | + ->method('setOption') |
| 82 | + ->with('type', 'memory'); |
| 83 | + |
| 84 | + $this->model->build($this->changeLog); |
| 85 | + } |
| 86 | +} |
0 commit comments