Skip to content

Commit f6ad9d9

Browse files
committed
Merge branch '2.4-develop' into Refactoring-AdminUpdateSimpleProductWithRegularPriceOutOfStockTest
# Conflicts: # app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml
2 parents 5c5b837 + be82efb commit f6ad9d9

File tree

435 files changed

+8756
-1864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

435 files changed

+8756
-1864
lines changed

app/code/Magento/Authorization/Model/Role.php

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,32 @@
55
*/
66
namespace Magento\Authorization\Model;
77

8+
use Magento\Authorization\Model\ResourceModel\Role\Collection;
9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\Framework\Model\AbstractModel;
11+
812
/**
913
* Admin Role Model
1014
*
1115
* @api
1216
* @method int getParentId()
13-
* @method \Magento\Authorization\Model\Role setParentId(int $value)
17+
* @method Role setParentId(int $value)
1418
* @method int getTreeLevel()
15-
* @method \Magento\Authorization\Model\Role setTreeLevel(int $value)
19+
* @method Role setTreeLevel(int $value)
1620
* @method int getSortOrder()
17-
* @method \Magento\Authorization\Model\Role setSortOrder(int $value)
21+
* @method Role setSortOrder(int $value)
1822
* @method string getRoleType()
19-
* @method \Magento\Authorization\Model\Role setRoleType(string $value)
23+
* @method Role setRoleType(string $value)
2024
* @method int getUserId()
21-
* @method \Magento\Authorization\Model\Role setUserId(int $value)
25+
* @method Role setUserId(int $value)
2226
* @method string getUserType()
23-
* @method \Magento\Authorization\Model\Role setUserType(string $value)
27+
* @method Role setUserType(string $value)
2428
* @method string getRoleName()
25-
* @method \Magento\Authorization\Model\Role setRoleName(string $value)
29+
* @method Role setRoleName(string $value)
2630
* @api
2731
* @since 100.0.2
2832
*/
29-
class Role extends \Magento\Framework\Model\AbstractModel
33+
class Role extends AbstractModel
3034
{
3135
/**
3236
* @var string
@@ -38,23 +42,6 @@ class Role extends \Magento\Framework\Model\AbstractModel
3842
*/
3943
protected $_cacheTag = 'user_assigned_role';
4044

41-
/**
42-
* @param \Magento\Framework\Model\Context $context
43-
* @param \Magento\Framework\Registry $registry
44-
* @param \Magento\Authorization\Model\ResourceModel\Role $resource
45-
* @param \Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection
46-
* @param array $data
47-
*/
48-
public function __construct( //phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod
49-
\Magento\Framework\Model\Context $context,
50-
\Magento\Framework\Registry $registry,
51-
\Magento\Authorization\Model\ResourceModel\Role $resource,
52-
\Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection,
53-
array $data = []
54-
) {
55-
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
56-
}
57-
5845
/**
5946
* @inheritDoc
6047
*/
@@ -70,31 +57,30 @@ public function __sleep()
7057
public function __wakeup()
7158
{
7259
parent::__wakeup();
73-
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
74-
$this->_resource = $objectManager->get(\Magento\Authorization\Model\ResourceModel\Role::class);
75-
$this->_resourceCollection = $objectManager->get(
76-
\Magento\Authorization\Model\ResourceModel\Role\Collection::class
77-
);
60+
$objectManager = ObjectManager::getInstance();
61+
$this->_resource = $objectManager->get(ResourceModel\Role::class);
62+
$this->_resourceCollection = $objectManager->get(Collection::class);
7863
}
7964

8065
/**
81-
* Class constructor
82-
*
83-
* @return void
66+
* @inheritdoc
8467
*/
8568
protected function _construct()
8669
{
87-
$this->_init(\Magento\Authorization\Model\ResourceModel\Role::class);
70+
$this->_init(ResourceModel\Role::class);
8871
}
8972

9073
/**
91-
* Update object into database
74+
* Obsolete method of update
9275
*
9376
* @return $this
77+
* @deprecated Method was never implemented and used.
9478
*/
9579
public function update()
9680
{
97-
$this->getResource()->update($this);
81+
// phpcs:disable Magento2.Functions.DiscouragedFunction
82+
trigger_error('Method was never implemented and used.', E_USER_DEPRECATED);
83+
9884
return $this;
9985
}
10086

app/code/Magento/AwsS3/Test/Mftf/Helper/S3FileAssertions.php

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function deleteDirectory($path): void
146146
*/
147147
public function assertFileExists($filePath, $message = ''): void
148148
{
149-
$this->assertTrue($this->driver->isExists($filePath), $message);
149+
$this->assertTrue($this->driver->isExists($filePath), "Failed asserting $filePath exists. " . $message);
150150
}
151151

152152
/**
@@ -158,10 +158,38 @@ public function assertFileExists($filePath, $message = ''): void
158158
*
159159
* @throws \Magento\Framework\Exception\FileSystemException
160160
*/
161-
public function assertGlobbedFileExists($path, $pattern, $message = ""): void
161+
public function assertGlobbedFileExists($path, $pattern, $message = ''): void
162162
{
163163
$files = $this->driver->search($pattern, $path);
164-
$this->assertNotEmpty($files, $message);
164+
$this->assertNotEmpty($files, "Failed asserting file matching glob pattern \"$pattern\" at location \"$path\" is not empty. " . $message);
165+
}
166+
167+
/**
168+
* Asserts that a file or directory exists on the remote storage system
169+
*
170+
* @param string $path
171+
* @param string $message
172+
* @return void
173+
*
174+
* @throws \Magento\Framework\Exception\FileSystemException
175+
*/
176+
public function assertPathExists($path, $message = ''): void
177+
{
178+
$this->assertTrue($this->driver->isExists($path), "Failed asserting $path exists. " . $message);
179+
}
180+
181+
/**
182+
* Asserts that a file or directory does not exist on the remote storage system
183+
*
184+
* @param string $path
185+
* @param string $message
186+
* @return void
187+
*
188+
* @throws \Magento\Framework\Exception\FileSystemException
189+
*/
190+
public function assertPathDoesNotExist($path, $message = ''): void
191+
{
192+
$this->assertFalse($this->driver->isExists($path), "Failed asserting $path does not exist. " . $message);
165193
}
166194

167195
/**
@@ -187,9 +215,9 @@ public function assertFileDoesNotExist($filePath, $message = ''): void
187215
*
188216
* @throws \Magento\Framework\Exception\FileSystemException
189217
*/
190-
public function assertFileEmpty($filePath, $message = ""): void
218+
public function assertFileEmpty($filePath, $message = ''): void
191219
{
192-
$this->assertEmpty($this->driver->fileGetContents($filePath), $message);
220+
$this->assertEmpty($this->driver->fileGetContents($filePath), "Failed asserting $filePath is empty. " . $message);
193221
}
194222

195223
/**
@@ -201,9 +229,9 @@ public function assertFileEmpty($filePath, $message = ""): void
201229
*
202230
* @throws \Magento\Framework\Exception\FileSystemException
203231
*/
204-
public function assertFileNotEmpty($filePath, $message = ""): void
232+
public function assertFileNotEmpty($filePath, $message = ''): void
205233
{
206-
$this->assertNotEmpty($this->driver->fileGetContents($filePath), $message);
234+
$this->assertNotEmpty($this->driver->fileGetContents($filePath), "Failed asserting $filePath is not empty. " . $message);
207235
}
208236

209237
/**
@@ -216,9 +244,9 @@ public function assertFileNotEmpty($filePath, $message = ""): void
216244
*
217245
* @throws \Magento\Framework\Exception\FileSystemException
218246
*/
219-
public function assertFileContainsString($filePath, $text, $message = ""): void
247+
public function assertFileContainsString($filePath, $text, $message = ''): void
220248
{
221-
$this->assertStringContainsString($text, $this->driver->fileGetContents($filePath), $message);
249+
$this->assertStringContainsString($text, $this->driver->fileGetContents($filePath), "Failed asserting $filePath contains $text. " . $message);
222250
}
223251

224252
/**
@@ -233,10 +261,10 @@ public function assertFileContainsString($filePath, $text, $message = ""): void
233261
*
234262
* @throws \Magento\Framework\Exception\FileSystemException
235263
*/
236-
public function assertGlobbedFileContainsString($path, $pattern, $text, $fileIndex = 0, $message = ""): void
264+
public function assertGlobbedFileContainsString($path, $pattern, $text, $fileIndex = 0, $message = ''): void
237265
{
238266
$files = $this->driver->search($pattern, $path);
239-
$this->assertStringContainsString($text, $this->driver->fileGetContents($files[$fileIndex] ?? ''), $message);
267+
$this->assertStringContainsString($text, $this->driver->fileGetContents($files[$fileIndex] ?? ''), "Failed asserting file of index \"$fileIndex\" matching glob pattern \"$pattern\" at location \"$path\" contains $text. " . $message);
240268
}
241269

242270
/**
@@ -249,9 +277,9 @@ public function assertGlobbedFileContainsString($path, $pattern, $text, $fileInd
249277
*
250278
* @throws \Magento\Framework\Exception\FileSystemException
251279
*/
252-
public function assertFileDoesNotContain($filePath, $text, $message = ""): void
280+
public function assertFileDoesNotContainString($filePath, $text, $message = ''): void
253281
{
254-
$this->assertStringNotContainsString($text, $this->driver->fileGetContents($filePath), $message);
282+
$this->assertStringNotContainsString($text, $this->driver->fileGetContents($filePath), "Failed asserting $filePath does not contain $text. " . $message);
255283
}
256284

257285
/**
@@ -263,8 +291,22 @@ public function assertFileDoesNotContain($filePath, $text, $message = ""): void
263291
*
264292
* @throws \Magento\Framework\Exception\FileSystemException
265293
*/
266-
public function assertDirectoryEmpty($path, $message = ""): void
294+
public function assertDirectoryEmpty($path, $message = ''): void
295+
{
296+
$this->assertEmpty($this->driver->readDirectory($path), "Failed asserting $path is empty. " . $message);
297+
}
298+
299+
/**
300+
* Asserts that a directory on the remote storage system is not empty
301+
*
302+
* @param string $path
303+
* @param string $message
304+
* @return void
305+
*
306+
* @throws \Magento\Framework\Exception\FileSystemException
307+
*/
308+
public function assertDirectoryNotEmpty($path, $message = ''): void
267309
{
268-
$this->assertEmpty($this->driver->readDirectory($path), $message);
310+
$this->assertNotEmpty($this->driver->readDirectory($path), "Failed asserting $path is not empty. " . $message);
269311
}
270312
}

0 commit comments

Comments
 (0)