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/module-backup/Test/Unit/Model/Fs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/old/vendor/magento/module-backup/Test/Unit/Model/Fs/CollectionTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Backup\Test\Unit\Model\Fs;

use Magento\Backup\Helper\Data;
use Magento\Backup\Model\Fs\Collection;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\TargetDirectory;
use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\TestCase;

class CollectionTest extends TestCase
{
    /**
     * @return void
     */
    public function testConstructor(): void
    {
        $helper = new ObjectManager($this);
        $filesystem = $this->getMockBuilder(Filesystem::class)
            ->disableOriginalConstructor()
            ->getMock();
        $directoryWrite = $this->getMockBuilder(
            WriteInterface::class
        )->disableOriginalConstructor()
            ->getMock();
        $filesystem->expects($this->any())->method('getDirectoryWrite')->willReturn($directoryWrite);

        $backupData = $this->getMockBuilder(
            Data::class
        )->disableOriginalConstructor()
            ->getMock();
        $backupData->expects($this->any())->method('getExtensions')->willReturn([]);
        $driver = $this->getMockBuilder(
            Filesystem\DriverInterface::class
        )->disableOriginalConstructor()
            ->getMock();
        $directoryWrite->expects($this->any())->method('create')->with('backups');
        $directoryWrite->method('getAbsolutePath')
            ->withConsecutive([], [], ['backups'])
            ->willReturnOnConsecutiveCalls('', '');
        $directoryWrite->expects($this->any())->method('isDirectory')->willReturn(true);
        $directoryWrite->expects($this->any())->method('getDriver')->willReturn($driver);
        $targetDirectory = $this->getMockBuilder(TargetDirectory::class)
            ->disableOriginalConstructor()
            ->getMock();
        $targetDirectoryWrite = $this->getMockBuilder(WriteInterface::class)
            ->disableOriginalConstructor()
            ->getMock();
        $targetDirectoryWrite->expects($this->any())->method('isDirectory')->willReturn(true);
        $targetDirectory->expects($this->any())->method('getDirectoryWrite')->willReturn($targetDirectoryWrite);
        $classObject = $helper->getObject(
            Collection::class,
            [
                'filesystem' => $filesystem,
                'backupData' => $backupData,
                'directoryWrite' => $directoryWrite,
                'targetDirectory' => $targetDirectory
            ]
        );
        $this->assertNotNull($classObject);
    }
}

Spamworldpro Mini