Skip to content

Commit

Permalink
Merge branch '2.4-develop' into refactoring-AdminConfigurableProductR…
Browse files Browse the repository at this point in the history
…emoveAnOptionTest

# Conflicts:
#	app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductRemoveAnOptionTest.xml
  • Loading branch information
kate-kyzyma committed Apr 6, 2021
2 parents 134e715 + be82efb commit 49ecc2a
Show file tree
Hide file tree
Showing 601 changed files with 20,041 additions and 2,382 deletions.
58 changes: 22 additions & 36 deletions app/code/Magento/Authorization/Model/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,32 @@
*/
namespace Magento\Authorization\Model;

use Magento\Authorization\Model\ResourceModel\Role\Collection;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Model\AbstractModel;

/**
* Admin Role Model
*
* @api
* @method int getParentId()
* @method \Magento\Authorization\Model\Role setParentId(int $value)
* @method Role setParentId(int $value)
* @method int getTreeLevel()
* @method \Magento\Authorization\Model\Role setTreeLevel(int $value)
* @method Role setTreeLevel(int $value)
* @method int getSortOrder()
* @method \Magento\Authorization\Model\Role setSortOrder(int $value)
* @method Role setSortOrder(int $value)
* @method string getRoleType()
* @method \Magento\Authorization\Model\Role setRoleType(string $value)
* @method Role setRoleType(string $value)
* @method int getUserId()
* @method \Magento\Authorization\Model\Role setUserId(int $value)
* @method Role setUserId(int $value)
* @method string getUserType()
* @method \Magento\Authorization\Model\Role setUserType(string $value)
* @method Role setUserType(string $value)
* @method string getRoleName()
* @method \Magento\Authorization\Model\Role setRoleName(string $value)
* @method Role setRoleName(string $value)
* @api
* @since 100.0.2
*/
class Role extends \Magento\Framework\Model\AbstractModel
class Role extends AbstractModel
{
/**
* @var string
Expand All @@ -38,23 +42,6 @@ class Role extends \Magento\Framework\Model\AbstractModel
*/
protected $_cacheTag = 'user_assigned_role';

/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Authorization\Model\ResourceModel\Role $resource
* @param \Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection
* @param array $data
*/
public function __construct( //phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Authorization\Model\ResourceModel\Role $resource,
\Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection,
array $data = []
) {
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}

/**
* @inheritDoc
*/
Expand All @@ -70,31 +57,30 @@ public function __sleep()
public function __wakeup()
{
parent::__wakeup();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$this->_resource = $objectManager->get(\Magento\Authorization\Model\ResourceModel\Role::class);
$this->_resourceCollection = $objectManager->get(
\Magento\Authorization\Model\ResourceModel\Role\Collection::class
);
$objectManager = ObjectManager::getInstance();
$this->_resource = $objectManager->get(ResourceModel\Role::class);
$this->_resourceCollection = $objectManager->get(Collection::class);
}

/**
* Class constructor
*
* @return void
* @inheritdoc
*/
protected function _construct()
{
$this->_init(\Magento\Authorization\Model\ResourceModel\Role::class);
$this->_init(ResourceModel\Role::class);
}

/**
* Update object into database
* Obsolete method of update
*
* @return $this
* @deprecated Method was never implemented and used.
*/
public function update()
{
$this->getResource()->update($this);
// phpcs:disable Magento2.Functions.DiscouragedFunction
trigger_error('Method was never implemented and used.', E_USER_DEPRECATED);

return $this;
}

Expand Down
97 changes: 86 additions & 11 deletions app/code/Magento/AwsS3/Test/Mftf/Helper/S3FileAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,50 @@ public function deleteDirectory($path): void
*/
public function assertFileExists($filePath, $message = ''): void
{
$this->assertTrue($this->driver->isExists($filePath), $message);
$this->assertTrue($this->driver->isExists($filePath), "Failed asserting $filePath exists. " . $message);
}

/**
* Asserts that a file with the given glob pattern exists in the given path on the remote storage system
*
* @param string $path
* @param string $pattern
* @param string $message
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertGlobbedFileExists($path, $pattern, $message = ''): void
{
$files = $this->driver->search($pattern, $path);
$this->assertNotEmpty($files, "Failed asserting file matching glob pattern \"$pattern\" at location \"$path\" is not empty. " . $message);
}

/**
* Asserts that a file or directory exists on the remote storage system
*
* @param string $path
* @param string $message
* @return void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertPathExists($path, $message = ''): void
{
$this->assertTrue($this->driver->isExists($path), "Failed asserting $path exists. " . $message);
}

/**
* Asserts that a file or directory does not exist on the remote storage system
*
* @param string $path
* @param string $message
* @return void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertPathDoesNotExist($path, $message = ''): void
{
$this->assertFalse($this->driver->isExists($path), "Failed asserting $path does not exist. " . $message);
}

/**
Expand All @@ -172,9 +215,9 @@ public function assertFileDoesNotExist($filePath, $message = ''): void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertFileEmpty($filePath, $message = ""): void
public function assertFileEmpty($filePath, $message = ''): void
{
$this->assertEmpty($this->driver->fileGetContents($filePath), $message);
$this->assertEmpty($this->driver->fileGetContents($filePath), "Failed asserting $filePath is empty. " . $message);
}

/**
Expand All @@ -186,9 +229,9 @@ public function assertFileEmpty($filePath, $message = ""): void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertFileNotEmpty($filePath, $message = ""): void
public function assertFileNotEmpty($filePath, $message = ''): void
{
$this->assertNotEmpty($this->driver->fileGetContents($filePath), $message);
$this->assertNotEmpty($this->driver->fileGetContents($filePath), "Failed asserting $filePath is not empty. " . $message);
}

/**
Expand All @@ -201,9 +244,27 @@ public function assertFileNotEmpty($filePath, $message = ""): void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertFileContainsString($filePath, $text, $message = ""): void
public function assertFileContainsString($filePath, $text, $message = ''): void
{
$this->assertStringContainsString($text, $this->driver->fileGetContents($filePath), $message);
$this->assertStringContainsString($text, $this->driver->fileGetContents($filePath), "Failed asserting $filePath contains $text. " . $message);
}

/**
* Asserts that a file with the given glob pattern at the given path on the remote storage system contains a given string
*
* @param string $path
* @param string $pattern
* @param string $text
* @param int $fileIndex
* @param string $message
* @return void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertGlobbedFileContainsString($path, $pattern, $text, $fileIndex = 0, $message = ''): void
{
$files = $this->driver->search($pattern, $path);
$this->assertStringContainsString($text, $this->driver->fileGetContents($files[$fileIndex] ?? ''), "Failed asserting file of index \"$fileIndex\" matching glob pattern \"$pattern\" at location \"$path\" contains $text. " . $message);
}

/**
Expand All @@ -216,9 +277,9 @@ public function assertFileContainsString($filePath, $text, $message = ""): void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertFileDoesNotContain($filePath, $text, $message = ""): void
public function assertFileDoesNotContainString($filePath, $text, $message = ''): void
{
$this->assertStringNotContainsString($text, $this->driver->fileGetContents($filePath), $message);
$this->assertStringNotContainsString($text, $this->driver->fileGetContents($filePath), "Failed asserting $filePath does not contain $text. " . $message);
}

/**
Expand All @@ -230,8 +291,22 @@ public function assertFileDoesNotContain($filePath, $text, $message = ""): void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertDirectoryEmpty($path, $message = ""): void
public function assertDirectoryEmpty($path, $message = ''): void
{
$this->assertEmpty($this->driver->readDirectory($path), "Failed asserting $path is empty. " . $message);
}

/**
* Asserts that a directory on the remote storage system is not empty
*
* @param string $path
* @param string $message
* @return void
*
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function assertDirectoryNotEmpty($path, $message = ''): void
{
$this->assertEmpty($this->driver->readDirectory($path), $message);
$this->assertNotEmpty($this->driver->readDirectory($path), "Failed asserting $path is not empty. " . $message);
}
}
Loading

0 comments on commit 49ecc2a

Please sign in to comment.