Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b7167fc
Fix integration tests for Page Builder
lbajsarowicz Feb 28, 2020
87db3ee
Replace invalid return type
lbajsarowicz Feb 28, 2020
534fff7
#27117 Add `Test` suffix for Test names (Assuming that filename is co…
lbajsarowicz Mar 1, 2020
d5db946
#27117 Fix invalid file names for Functional Tests
lbajsarowicz Mar 1, 2020
b9c9435
Merge remote-tracking branch 'origin/develop' into architecture/actio…
lbajsarowicz Mar 2, 2020
6e0c0fa
magento/community-features#9: Eliminate the need for inheritance for …
lenaorobei Mar 2, 2020
ff30b31
Merge branch 'develop' into architecture/action-interface
lenaorobei Mar 3, 2020
f7028b3
Merge branch 'develop' into architecture/action-interface
lenaorobei Mar 3, 2020
fe9daa1
Merge pull request #398 from lbajsarowicz/architecture/action-interface
omiroshnichenko Mar 3, 2020
ebe6e4c
PB-425: Update Video Alignment MFTF Video Tests
dhaecker Mar 5, 2020
e32b3fd
PB-425: Update Video Alignment MFTF Video Tests
dhaecker Mar 6, 2020
1855fde
PB-425: Update Video Alignment MFTF Video Tests
dhaecker Mar 6, 2020
16e2f00
Merge remote-tracking branch 'origin/develop' into refactor/test-names
lbajsarowicz Mar 7, 2020
7c11973
Merge branch 'develop' into PB-425
omiroshnichenko Mar 11, 2020
ccb6219
MC-32070: [Functional Test Failed]:Magento\FunctionalTestingFramework…
omiroshnichenko Mar 12, 2020
0a62792
MC-32070: [Functional Test Failed]:Magento\FunctionalTestingFramework…
omiroshnichenko Mar 12, 2020
981c13b
Merge pull request #401 from magento-obsessive-owls/MC-32070
omiroshnichenko Mar 13, 2020
8eccf75
Merge branch 'develop' into PB-425
omiroshnichenko Mar 13, 2020
98c6d16
Merge pull request #400 from magento-obsessive-owls/PB-425
omiroshnichenko Mar 13, 2020
6a3b28c
Revert "[Owls] PB-425: Update Video Alignment MFTF Video Tests"
omiroshnichenko Mar 13, 2020
833191a
Merge pull request #405 from magento/revert-400-PB-425
omiroshnichenko Mar 13, 2020
949b908
:arrows_clockwise: FIX #27117 Invalid functional Test names
magento-engcom-team Mar 18, 2020
dd4fea7
PB-457: Fix copy & paste failing test in PageBuilder static tests
anthoula Mar 23, 2020
e7136f0
PB-457: Fix copy & paste failing test in PageBuilder static tests
anthoula Mar 23, 2020
59ae4e8
PB-457: Fix copy & paste failing test in PageBuilder static tests
omiroshnichenko Mar 23, 2020
a334888
PB-457: Fix copy & paste failing test in PageBuilder static tests
anthoula Mar 24, 2020
f7f8f4d
PB-457: Fix copy & paste failing test in PageBuilder static tests
anthoula Mar 24, 2020
4bc0b5b
Merge pull request #411 from magento-obsessive-owls/PB-457
omiroshnichenko Mar 24, 2020
3af6cf0
Revert "FIX #27117 Invalid functional Test names"
lenaorobei Mar 25, 2020
3b07b42
Merge pull request #413 from lbajsarowicz/revert-399-refactor/test-names
dhaecker Mar 25, 2020
183b29a
MQE-2081: Functional Tests builds will only pass when MFTF and MTF ar…
okolesnyk Apr 17, 2020
ffd07dd
Merge pull request #455 from magento-pangolin/MQE-2081-prev
omiroshnichenko Apr 22, 2020
d8a5a2c
PB-518: Docs housework for 1.3 release
bdenham Apr 27, 2020
019951c
PB-518: Docs housework for 1.3 release
bdenham Apr 28, 2020
27e9007
Merge branch '1.3-develop' into PB-518
bdenham Apr 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/code/Magento/CatalogPageBuilderAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
"require": {
"magento/module-page-builder-analytics": "*",
"magento/module-catalog": "~103.0.5",
"magento/framework": "~102.0.5",
"magento/module-catalog": "*",
"magento/framework": "*",
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CmsPageBuilderAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"require": {
"magento/module-page-builder-analytics": "*",
"magento/module-cms": "*",
"magento/framework": "~102.0.5",
"magento/framework": "*",
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminDisableWYSIWYGActionGroup">
<magentoCLI command="config:set cms/pagebuilder/enabled 0" stepKey="disablePageBuilder"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminEnableWYSIWYGActionGroup">
<magentoCLI command="config:set cms/pagebuilder/enabled 1" stepKey="enablePageBuilder"/>
</actionGroup>
</actionGroups>

This file was deleted.

14 changes: 7 additions & 7 deletions app/code/Magento/PageBuilder/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"name": "magento/module-page-builder",
"description": "Page Builder module",
"require": {
"magento/framework": "~102.0.5",
"magento/framework": "*",
"magento/module-eav": "*",
"magento/module-store": "~101.0.5",
"magento/module-backend": "~101.0.5",
"magento/module-store": "*",
"magento/module-backend": "*",
"magento/module-cms": "*",
"magento/module-catalog": "~103.0.5",
"magento/module-catalog": "*",
"magento/module-catalog-inventory": "*",
"magento/module-config": "~101.1.5",
"magento/module-config": "*",
"magento/module-ui": "*",
"magento/module-variable": "*",
"magento/module-widget": "*",
"magento/module-catalog-widget": "*",
"magento/module-rule": "~100.3.5",
"magento/module-directory": "~100.3.5",
"magento/module-rule": "*",
"magento/module-directory": "*",
"magento/module-email": "*",
"magento/module-theme": "*",
"magento/module-wishlist": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
// ___________________________________________________________________

.transition {
-o-transition: .5s;
-ms-transition: .5s;
-moz-transition: .5s;
-ms-transition: .5s;
-o-transition: .5s;
-webkit-transition: .5s;
transition: .5s;
}
Expand All @@ -27,12 +27,6 @@
//
// Commented Backslash Hack
// ---------------------------------------------

.clearfix {
display: block;
}


* html .clearfix {
height: 1%;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/PageBuilderAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "magento/module-page-builder-analytics",
"description": "Page Builder Analytics module",
"require": {
"magento/module-analytics": "~100.3.5",
"magento/module-analytics": "*",
"magento/module-page-builder": "*",
"magento/framework": "~102.0.5",
"magento/framework": "*",
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,45 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\PageBuilder\Controller\Adminhtml\ContentType\Image;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Controller\Result\Json;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Framework\File\Mime;
use Magento\PageBuilder\Controller\Adminhtml\ContentType\Image\Upload as Controller;

/**
* Class UploadTest
*/
class UploadTest extends \PHPUnit\Framework\TestCase
use Magento\Framework\File\Uploader;
use Magento\Framework\File\UploaderFactory;
use Magento\Framework\ObjectManagerInterface;
use Magento\PageBuilder\Controller\Adminhtml\ContentType\Image\Upload as UploadController;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class UploadTest extends TestCase
{
/**
* @var \Magento\PageBuilder\Controller\Adminhtml\ContentType\Image\Upload
* @var UploadController
*/
private $controller;

/**
* @var \Magento\Framework\ObjectManagerInterface
* @var ObjectManagerInterface
*/
private $objectManager;

/**
* @var \Magento\Framework\File\UploaderFactory|\PHPUnit_Framework_MockObject_MockObject
* @var UploaderFactory|MockObject
*/
private $uploaderFactory;

/**
* @var \Magento\Framework\Controller\Result\Json|\PHPUnit_Framework_MockObject_MockObject
* @var Json|MockObject
*/
private $resultJson;

/**
* @var \Magento\Framework\Controller\Result\JsonFactory|\PHPUnit_Framework_MockObject_MockObject
* @var JsonFactory|MockObject
*/
private $resultJsonFactory;

Expand All @@ -46,23 +50,25 @@ class UploadTest extends \PHPUnit\Framework\TestCase
*/
protected function setUp()
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->objectManager = ObjectManager::getInstance();

$this->uploaderFactory = $this->createPartialMock(\Magento\Framework\File\UploaderFactory::class, ['create']);
$this->uploaderFactory = $this->createPartialMock(UploaderFactory::class, ['create']);

$this->resultJson = $this->getMockBuilder(\Magento\Framework\Controller\Result\Json::class)
$this->resultJson = $this->getMockBuilder(Json::class)
->setMethods(['setData'])
->disableOriginalConstructor()
->getMock();

$this->resultJsonFactory = $this->getMockBuilder(\Magento\Framework\Controller\Result\JsonFactory::class)
$this->resultJsonFactory = $this->getMockBuilder(JsonFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();

$this->resultJsonFactory->expects($this->once())->method('create')->willReturn($this->resultJson);
$this->resultJsonFactory->expects($this->once())
->method('create')
->willReturn($this->resultJson);

$this->controller = $this->objectManager->create(Controller::class, [
$this->controller = $this->objectManager->create(UploadController::class, [
'resultJsonFactory' => $this->resultJsonFactory,
'uploaderFactory' => $this->uploaderFactory
]);
Expand All @@ -78,33 +84,40 @@ protected function tearDown()

/**
* Assert that file validation passes when uploaded file has correct extension and valid mime type
* @magentoAppArea adminhtml
*/
public function testFileValidationPassesWhenFileHasCorrectExtensionAndValidMimeType()
{
$valid_file_pathname = realpath(dirname(__FILE__) . '/../../../../_files/uploader/a.png');
$valid_file_pathname = realpath(__DIR__ . '/../../../../_files/uploader/a.png');

$_FILES = [
'background_image' => [
'type' => 'image/png',
'name' => basename($valid_file_pathname),
'tmp_name' => $valid_file_pathname,
'size' => filesize($valid_file_pathname),
'error' => UPLOAD_ERR_OK,
]
];
$this->setFilesGlobalMock($valid_file_pathname);
$this->setUploaderMockForField('background_image');

$uploader = $this->objectManager->create(\Magento\Framework\File\Uploader::class, [
'fileId' => 'background_image',
'fileMime' => $this->objectManager->create(Mime::class),
]);
$this->resultJson->expects($this->once())
->method('setData')
->willReturnCallback(function ($result) {
$this->assertNotEquals([
'error' => 'File validation failed.',
'errorcode' => 0
], $result);
});

$this->uploaderFactory
->expects($this->once())
->method('create')
->will($this->returnValue($uploader));
$this->controller->execute();
}

/**
* Assert that file validation fails when uploaded file has correct extension but invalid mime type
* @magentoAppArea adminhtml
*/
public function testFileValidationFailsWhenFileHasCorrectExtensionButInvalidMimeType()
{
$invalid_file_pathname = realpath(__DIR__ . '/../../../../_files/uploader/not-a.png');

$this->setFilesGlobalMock($invalid_file_pathname);
$this->setUploaderMockForField('background_image');

$this->resultJson->expects($this->once())->method('setData')->willReturnCallback(function ($result) {
$this->assertNotEquals([
$this->assertEquals([
'error' => 'File validation failed.',
'errorcode' => 0
], $result);
Expand All @@ -114,39 +127,40 @@ public function testFileValidationPassesWhenFileHasCorrectExtensionAndValidMimeT
}

/**
* Assert that file validation fails when uploaded file has correct extension but invalid mime type
* Initiates Uploader object for `$fieldId` and returns as a result of `UploaderFactory::create()`
*
* @param string $fieldId
* @return void
*/
public function testFileValidationFailsWhenFileHasCorrectExtensionButInvalidMimeType()
private function setUploaderMockForField(string $fieldId): void
{
$invalid_file_pathname = realpath(dirname(__FILE__) . '/../../../../_files/uploader/not-a.png');

$_FILES = [
'background_image' => [
'type' => 'image/png',
'name' => basename($invalid_file_pathname),
'tmp_name' => $invalid_file_pathname,
'size' => filesize($invalid_file_pathname),
'error' => UPLOAD_ERR_OK,
]
];

$uploader = $this->objectManager->create(\Magento\Framework\File\Uploader::class, [
'fileId' => 'background_image',
$uploader = $this->objectManager->create(Uploader::class, [
'fileId' => $fieldId,
'fileMime' => $this->objectManager->create(Mime::class),
]);

$this->uploaderFactory
->expects($this->once())
->method('create')
->will($this->returnValue($uploader));
}

$this->resultJson->expects($this->once())->method('setData')->willReturnCallback(function ($result) {
$this->assertEquals([
'error' => 'File validation failed.',
'errorcode' => 0
], $result);
});

$this->controller->execute();
/**
* Mock that `$pathname` was uploaded (mock of `$_FILES` array)
*
* @param string $pathname
* @return void
*/
private function setFilesGlobalMock(string $pathname): void
{
$_FILES = [
'background_image' => [
'type' => 'image/png',
'name' => basename($pathname),
'tmp_name' => $pathname,
'size' => filesize($pathname),
'error' => UPLOAD_ERR_OK,
]
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Magento/PageBuilder/Model/ResourceModel/Template/Grid
Loading