Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ protected function setUp()
* @dataProvider errorDataProvider
* @param string $reportName
* @param array $result
* @param \PHPUnit_Framework_MockObject_Stub $queryReturnStub
* @param \PHPUnit\Framework\MockObject\Stub $queryReturnStub
*/
public function testValidate($reportName, $result, \PHPUnit_Framework_MockObject_Stub $queryReturnStub)
public function testValidate($reportName, $result, \PHPUnit\Framework\MockObject\Stub $queryReturnStub)
{
$connectionName = 'testConnection';
$this->queryFactoryMock->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use Magento\Customer\Model\Session;
use Magento\Framework\App\Request\Http;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit_Framework_MockObject_Builder_InvocationMocker as InvocationMocker;
use PHPUnit_Framework_MockObject_Matcher_InvokedCount as InvokedCount;
use PHPUnit\Framework\MockObject\Builder\InvocationMocker as InvocationMocker;
use PHPUnit\Framework\MockObject\Matcher\InvokedCount as InvokedCount;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use Magento\Checkout\Helper\Data;
use Magento\Quote\Model\Quote;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ protected function setUp()

/**
* @param bool $hasBackendModel
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsGetBackendModel
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsCreate
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsGetValue
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetPath
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetScope
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetScopeId
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetValue
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsAfterLoad
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSerialize
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsGetBackendModel
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsCreate
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsGetValue
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetPath
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetScope
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetScopeId
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetValue
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsAfterLoad
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSerialize
* @param string $expectsValue
* @param string $className
* @param string $value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function testException()
}

/**
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $firstExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $firstExpects
* @param bool $firstResult
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $secondExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $secondExpects
* @param bool $secondResult
* @param bool $expectedResult
* @dataProvider visibilityDataProvider
Expand All @@ -74,9 +74,9 @@ public function testDisabled($firstExpects, $firstResult, $secondExpects, $secon
}

/**
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $firstExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $firstExpects
* @param bool $firstResult
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $secondExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $secondExpects
* @param bool $secondResult
* @param bool $expectedResult
* @dataProvider visibilityDataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,101 @@
* See COPYING.txt for license details.
*/

namespace Magento\Developer\Test\Unit\Console\Command;
// @codingStandardsIgnoreStart

use Magento\Developer\Console\Command\DevTestsRunCommand;
use Symfony\Component\Console\Tester\CommandTester;
namespace Magento\Developer\Console\Command {
use Symfony\Component\Console\Tester\CommandTester;

/**
* Class DevTestsRunCommandTest
*
* Tests dev:tests:run command. Only tests error case because DevTestsRunCommand calls phpunit with
* passthru, so there is no good way to mock out running the tests.
*/
class DevTestsRunCommandTest extends \PHPUnit\Framework\TestCase
{
$devTestsRunCommandTestPassthruReturnVar = null;

/**
* @var DevTestsRunCommand
* Mock for PHP builtin passthtru function
*
* @param string $command
* @param int|null $return_var
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
private $command;

protected function setUp()
function passthru($command, &$return_var = null)
{
$this->command = new DevTestsRunCommand();
global $devTestsRunCommandTestPassthruReturnVar;
$return_var = $devTestsRunCommandTestPassthruReturnVar;
}

public function testExecuteBadType()
/**
* Class DevTestsRunCommandTest
*
* Tests dev:tests:run command. Only tests error case because DevTestsRunCommand calls phpunit with
* passthru, so there is no good way to mock out running the tests.
*/
class DevTestsRunCommandTest extends \PHPUnit\Framework\TestCase
{
$commandTester = new CommandTester($this->command);
$commandTester->execute([DevTestsRunCommand::INPUT_ARG_TYPE => 'bad']);
$this->assertContains('Invalid type: "bad"', $commandTester->getDisplay());
}

public function testPassArgumentsToPHPUnit()
{
$commandTester = new CommandTester($this->command);
$commandTester->execute(
[
DevTestsRunCommand::INPUT_ARG_TYPE => 'unit',
'-' . DevTestsRunCommand::INPUT_OPT_COMMAND_ARGUMENTS_SHORT => '--list-suites',
]
);
$this->assertContains(
'phpunit --list-suites',
$commandTester->getDisplay(),
'Parameters should be passed to PHPUnit'
);
/**
* @var DevTestsRunCommand
*/
private $command;

protected function setUp()
{
$this->command = new DevTestsRunCommand();
}

public function testExecuteBadType()
{
$commandTester = new CommandTester($this->command);
$commandTester->execute([DevTestsRunCommand::INPUT_ARG_TYPE => 'bad']);
$this->assertContains('Invalid type: "bad"', $commandTester->getDisplay());
}

public function testPassArgumentsToPHPUnit()
{
global $devTestsRunCommandTestPassthruReturnVar;

$devTestsRunCommandTestPassthruReturnVar = 0;

$commandTester = new CommandTester($this->command);
$commandTester->execute(
[
DevTestsRunCommand::INPUT_ARG_TYPE => 'unit',
'-' . DevTestsRunCommand::INPUT_OPT_COMMAND_ARGUMENTS_SHORT => '--list-suites',
]
);
$this->assertContains(
'phpunit --list-suites',
$commandTester->getDisplay(),
'Parameters should be passed to PHPUnit'
);
$this->assertContains(
'PASSED (',
$commandTester->getDisplay(),
'PHPUnit runs should have passed'
);
}

public function testPassArgumentsToPHPUnitNegative()
{
global $devTestsRunCommandTestPassthruReturnVar;

$devTestsRunCommandTestPassthruReturnVar = 255;

$commandTester = new CommandTester($this->command);
$commandTester->execute(
[
DevTestsRunCommand::INPUT_ARG_TYPE => 'unit',
'-' . DevTestsRunCommand::INPUT_OPT_COMMAND_ARGUMENTS_SHORT => '--list-suites',
]
);
$this->assertContains(
'phpunit --list-suites',
$commandTester->getDisplay(),
'Parameters should be passed to PHPUnit'
);
$this->assertContains(
'FAILED - ',
$commandTester->getDisplay(),
'PHPUnit runs should have passed'
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ protected function setUp()
/**
* @param int|null $id
* @param string $typeId
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetTitle
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetValue
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectedGetTitle
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectedGetValue
* @return void
* @dataProvider getLinksTitleDataProvider
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
if (isset($methodsForms[$code])) {
$block->setMethodFormTemplate($code, $methodsForms[$code]);
}
?>
?>
<dt class="item-title">
<?php if ($methodsCount > 1) : ?>
<input type="radio"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $orderIds = $block->getOrderIds();
<div class="multicheckout results">
<p class="block-content">
<?php if (!empty($orderIds)) : ?>
<?= $block->escapeHtml(__('Not all items were included.')); ?>
<?= $block->escapeHtml(__('Not all items were included.')); ?>
<?php endif; ?>
<?= $block->escapeHtml(__('For details, see')); ?>
<a href="#failed"><?= $block->escapeHtml(__('Failed to Order')); ?></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<?php if ($shippingAddress) : ?>
<span class="shipping-label"><?= $block->escapeHtml(__('Ship to:')); ?></span>
<span class="shipping-address">
<?= $block->escapeHtml(
$block->getCheckoutData()->formatOrderShippingAddress($shippingAddress)
); ?>
<?= $block->escapeHtml(
$block->getCheckoutData()->formatOrderShippingAddress($shippingAddress)
); ?>
</span>
<?php else : ?>
<span class="shipping-address">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,18 @@ public function testExecuteWhenPersistentIsNotEnabled()
*
* @param string $refererUri
* @param string $requestUri
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expireCounter
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $dispatchCounter
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $setCustomerIdCounter
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expireCounter
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $dispatchCounter
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $setCustomerIdCounter
* @return void
* @dataProvider requestDataProvider
*/
public function testExecuteWhenPersistentIsEnabled(
string $refererUri,
string $requestUri,
\PHPUnit_Framework_MockObject_Matcher_InvokedCount $expireCounter,
\PHPUnit_Framework_MockObject_Matcher_InvokedCount $dispatchCounter,
\PHPUnit_Framework_MockObject_Matcher_InvokedCount $setCustomerIdCounter
\PHPUnit\Framework\MockObject\Matcher\InvokedCount $expireCounter,
\PHPUnit\Framework\MockObject\Matcher\InvokedCount $dispatchCounter,
\PHPUnit\Framework\MockObject\Matcher\InvokedCount $setCustomerIdCounter
): void {
$this->persistentHelperMock
->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function testCheckIsLive()
* @param int $useAggregatedData
* @param string $mainTable
* @param int $isFilter
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $getIfNullSqlResult
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $getIfNullSqlResult
* @dataProvider useAggregatedDataDataProvider
* @return void
*/
Expand Down Expand Up @@ -309,7 +309,7 @@ public function testAddItemCountExpr()
* @param int $isFilter
* @param int $useAggregatedData
* @param string $mainTable
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $getIfNullSqlResult
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $getIfNullSqlResult
* @dataProvider totalsDataProvider
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ function ($arg) {
/**
* @param mixed $from
* @param mixed $to
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $truncateCount
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $deleteCount
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $truncateCount
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $deleteCount
* @dataProvider intervalsDataProvider
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public function stepIdentityContainerInit($identityMockClassName)
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendCopyToExpects
*/
protected function stepSend(
\PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendExpects,
\PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendCopyToExpects
\PHPUnit\Framework\MockObject\Matcher\InvokedCount $sendExpects,
\PHPUnit\Framework\MockObject\Matcher\InvokedCount $sendCopyToExpects
) {
$senderMock = $this->createPartialMock(\Magento\Sales\Model\Order\Email\Sender::class, ['send', 'sendCopyTo']);
$senderMock->expects($sendExpects)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<?php foreach ($_methods as $_method) :
$_code = $_method->getCode();
$_counter++;
?>
?>
<dt class="admin__field-option">
<?php if ($_methodsCount > 1) : ?>
<input id="p_method_<?= $block->escapeHtml($_code); ?>"
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Ui/Model/Export/ConvertToCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Ui\Component\MassAction\Filter;

/**
Expand All @@ -18,7 +17,7 @@
class ConvertToCsv
{
/**
* @var WriteInterface
* @var DirectoryList
*/
protected $directory;

Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Ui/Model/Export/ConvertToXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Ui\Component\MassAction\Filter;

/**
Expand All @@ -22,7 +21,7 @@
class ConvertToXml
{
/**
* @var WriteInterface
* @var DirectoryList
*/
protected $directory;

Expand Down
Loading