Spamworldpro Mini Shell
Spamworldpro


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/framework/Api/Test/Unit/Search/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/framework/Api/Test/Unit/Search/SearchResultTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Framework\Api\Test\Unit\Search;

use Magento\Framework\Api\Search\DocumentInterface;
use Magento\Framework\Api\Search\SearchResult;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\TestCase;

class SearchResultTest extends TestCase
{
    /**
     * @var SearchResult
     */
    private $search;

    /**
     * @var DocumentInterface[]
     */
    private $items;

    /**
     * @var ObjectManager
     */
    private $objectManager;

    /**
     * Set up
     */
    protected function setUp(): void
    {
        $document1 = $this->getMockForAbstractClass(DocumentInterface::class);
        $document2 = $this->getMockForAbstractClass(DocumentInterface::class);

        $this->items = [ $document1,  $document2];
        $document1->expects($this->any())
            ->method('getId')
            ->willReturn(1);
        $document2->expects($this->any())
            ->method('getId')
            ->willReturn(2);

        $data = [
            'items' => $this->items
        ];
        $this->objectManager = new ObjectManager($this);
        $this->search = $this->objectManager->getObject(
            SearchResult::class,
            [
                'data' => $data
            ]
        );
    }

    /**
     * Test getItems
     */
    public function testGetItems()
    {
        $this->assertEquals($this->items, $this->search->getItems());
    }
}

Spamworldpro Mini