![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-cms/Test/Unit/Model/ResourceModel/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Cms\Test\Unit\Model\ResourceModel; use Magento\Framework\DB\Adapter\Pdo\Mysql; use Magento\Framework\DB\Select; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; abstract class AbstractCollectionTest extends TestCase { /** * @var Select|MockObject */ protected $select; /** * @var Mysql|MockObject */ protected $connection; /** * @var ObjectManager|MockObject */ protected $objectManager; /** * @var AbstractDb|MockObject */ protected $resource; protected function setUp(): void { $this->select = $this->getMockBuilder(Select::class) ->disableOriginalConstructor() ->getMock(); $this->connection = $this->getMockBuilder(Mysql::class) ->disableOriginalConstructor() ->getMock(); $this->connection->expects($this->any())->method('select')->willReturn($this->select); $this->resource = $this->getMockBuilder(AbstractDb::class) ->disableOriginalConstructor() ->setMethods(['getConnection', 'getMainTable', 'getTable']) ->getMockForAbstractClass(); $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection); $this->resource->expects($this->any())->method('getMainTable')->willReturn('table_test'); $this->resource->expects($this->any())->method('getTable')->willReturn('test'); $this->objectManager = new ObjectManager($this); } }