Skip to content

Commit

Permalink
Merge branch '2.4-develop' into dcmm2020
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Charlie committed Nov 6, 2020
2 parents ade5168 + aa272e6 commit 1f0bcbf
Show file tree
Hide file tree
Showing 897 changed files with 33,176 additions and 8,744 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml,json}]
indent_size = 2

[{composer, auth}.json]
indent_size = 4
4 changes: 2 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 76
daysUntilStale: 76

# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
Expand All @@ -18,7 +18,7 @@ exemptLabels:
- "Progress: dev in progress"
- "Progress: PR in progress"
- "Progress: done"
- "B2B: GraphQL"
- "B2B: GraphQL"
- "Progress: PR Created"
- "PAP"
- "Project: Login as Customer"
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/AdminNotification/Block/ToolbarEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* Toolbar entry that shows latest notifications
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class ToolbarEntry extends \Magento\Backend\Block\Template
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/AdminNotification/Model/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/**
* AdminNotification Feed model
*
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @api
* @since 100.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* AdminNotification Inbox interface
*
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* Notification service model
*
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* AdminNotification Inbox model
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\AdminNotification\Model\ResourceModel\Grid;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* AdminNotification Inbox model
*
* @api
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Collection of unread notifications
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

/**
* AdminNotification observer
*
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class PredispatchAdminActionControllerObserver implements ObserverInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Search queries relations grid container
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Edit extends \Magento\Backend\Block\Widget\Grid\Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Search query relations edit grid
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Grid extends \Magento\Backend\Block\Widget\Grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* Catalog search recommendations resource model
*
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Analytics/Model/ReportWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ public function write(WriteInterface $directory, $path)
/**
* Replace wrong symbols in row
*
* Strip backslashes before double quotes so they will be properly escaped in the generated csv
*
* @see fputcsv()
* @param array $row
* @return array
*/
private function prepareRow(array $row): array
{
$row = preg_replace('/(?<!\\\\)"/', '\\"', $row);
$row = preg_replace('/[\\\\]+/', '\\', $row);

return $row;
return preg_replace('/\\\+(?=\")/', '', $row);
}
}
55 changes: 32 additions & 23 deletions app/code/Magento/Analytics/ReportXml/ConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,65 @@

namespace Magento\Analytics\ReportXml;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\ResourceConnection\ConfigInterface as ResourceConfigInterface;
use Magento\Framework\Config\ConfigOptionsListConstants;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\Model\ResourceModel\Type\Db\ConnectionFactoryInterface;

/**
* Creates connection instance for export according to existing one
*
* This connection does not use buffered statement, also this connection is not persistent
*/
class ConnectionFactory
{
/**
* @var ResourceConnection
* @var ResourceConfigInterface
*/
private $resourceConnection;
private $resourceConfig;

/**
* @var ObjectManagerInterface
* @var DeploymentConfig
*/
private $objectManager;
private $deploymentConfig;

/**
* @param ResourceConnection $resourceConnection
* @param ObjectManagerInterface $objectManager
* @var ConnectionFactoryInterface
*/
private $connectionFactory;

/**
* @param ResourceConfigInterface $resourceConfig
* @param DeploymentConfig $deploymentConfig
* @param ConnectionFactoryInterface $connectionFactory
*/
public function __construct(
ResourceConnection $resourceConnection,
ObjectManagerInterface $objectManager
ResourceConfigInterface $resourceConfig,
DeploymentConfig $deploymentConfig,
ConnectionFactoryInterface $connectionFactory
) {
$this->resourceConnection = $resourceConnection;
$this->objectManager = $objectManager;
$this->resourceConfig = $resourceConfig;
$this->deploymentConfig = $deploymentConfig;
$this->connectionFactory = $connectionFactory;
}

/**
* Creates one-time connection for export
*
* @param string $connectionName
* @param string $resourceName
* @return AdapterInterface
*/
public function getConnection($connectionName)
public function getConnection($resourceName)
{
$connection = $this->resourceConnection->getConnection($connectionName);
$connectionClassName = get_class($connection);
$configData = $connection->getConfig();
$connectionName = $this->resourceConfig->getConnectionName($resourceName);
$configData = $this->deploymentConfig->get(
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . $connectionName
);
$configData['use_buffered_query'] = false;
unset($configData['persistent']);
return $this->objectManager->create(
$connectionClassName,
[
'config' => $configData
]
);
$connection = $this->connectionFactory->create($configData);

return $connection;
}
}
79 changes: 69 additions & 10 deletions app/code/Magento/Analytics/Test/Unit/Model/ReportWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function setUp(): void
* @param array $expectedFileData
* @return void
*
* @dataProvider configDataProvider
* @dataProvider writeDataProvider
*/
public function testWrite(array $configData, array $fileData, array $expectedFileData): void
{
Expand Down Expand Up @@ -162,7 +162,7 @@ public function testWrite(array $configData, array $fileData, array $expectedFil
* @param array $configData
* @return void
*
* @dataProvider configDataProvider
* @dataProvider writeErrorFileDataProvider
*/
public function testWriteErrorFile(array $configData): void
{
Expand Down Expand Up @@ -195,10 +195,75 @@ public function testWriteEmptyReports(): void
/**
* @return array
*/
public function configDataProvider(): array
public function writeDataProvider(): array
{
$configData = [
'providers' => [
[
'name' => $this->providerName,
'class' => $this->providerClass,
'parameters' => [
'name' => $this->reportName
],
]
]
];
return [
[
'configData' => $configData,
'fileData' => [
['number' => 1, 'type' => 'Shoes\"" Usual\\\\"']
],
'expectedFileData' => [
['number' => 1, 'type' => 'Shoes"" Usual"']
]
],
[
'configData' => $configData,
'fileData' => [
['number' => 1, 'type' => 'hello "World"']
],
'expectedFileData' => [
['number' => 1, 'type' => 'hello "World"']
]
],
[
'configData' => $configData,
'fileData' => [
['number' => 1, 'type' => 'hello \"World\"']
],
'expectedFileData' => [
['number' => 1, 'type' => 'hello "World"']
]
],
[
'configData' => $configData,
'fileData' => [
['number' => 1, 'type' => 'hello \\"World\\"']
],
'expectedFileData' => [
['number' => 1, 'type' => 'hello "World"']
]
],
[
'configData' => $configData,
'fileData' => [
['number' => 1, 'type' => 'hello \\\"World\\\"']
],
'expectedFileData' => [
['number' => 1, 'type' => 'hello "World"']
]
],
];
}

/**
* @return array
*/
public function writeErrorFileDataProvider(): array
{
return [
'reportProvider' => [
[
'configData' => [
'providers' => [
[
Expand All @@ -210,12 +275,6 @@ public function configDataProvider(): array
]
]
],
'fileData' => [
['number' => 1, 'type' => 'Shoes\"" Usual\\\\"']
],
'expectedFileData' => [
['number' => 1, 'type' => 'Shoes\"\" Usual\\"']
]
],
];
}
Expand Down
Loading

0 comments on commit 1f0bcbf

Please sign in to comment.