Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-developer
Test
Unit
Console
Command
ProfilerDisableCommandTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Developer\Test\Unit\Console\Command
;
8
9
use
Magento\Developer\Console\Command\ProfilerDisableCommand
;
10
use
Magento\Framework\Filesystem\Io\File
;
11
use PHPUnit\Framework\TestCase;
12
use Symfony\Component\Console\Tester\CommandTester;
13
19
class
ProfilerDisableCommandTest
extends
TestCase
20
{
24
private
$filesystemMock;
25
33
public
function
testCommand(
bool
$fileExists,
string
$expectedOutput)
34
{
35
$this->filesystemMock
36
->expects($this->once())
37
->method(
'rm'
)
38
->with(
BP
.
'/'
.
ProfilerDisableCommand::PROFILER_FLAG_FILE
);
39
$this->filesystemMock
40
->expects($this->once())
41
->method(
'fileExists'
)
42
->with(
BP
.
'/'
.
ProfilerDisableCommand::PROFILER_FLAG_FILE
)
43
->willReturn($fileExists);
45
$command =
new
ProfilerDisableCommand
($this->filesystemMock);
46
$commandTester =
new
CommandTester($command);
47
$commandTester->execute([]);
48
49
self::assertEquals(
50
$expectedOutput,
51
trim(str_replace(PHP_EOL,
' '
, $commandTester->getDisplay()))
52
);
53
}
54
60
public
function
commandDataProvider
()
61
{
62
return
[
63
[
true
,
'Something went wrong while disabling the profiler.'
],
64
[
false
,
'Profiler disabled.'
],
65
];
66
}
67
71
protected
function
setUp
()
72
{
73
$this->filesystemMock = $this->getMockBuilder(File::class)
74
->disableOriginalConstructor()
75
->getMock();
76
}
77
}
Magento\Developer\Test\Unit\Console\Command\ProfilerDisableCommandTest\commandDataProvider
commandDataProvider()
Definition:
ProfilerDisableCommandTest.php:60
Magento\Developer\Console\Command\ProfilerDisableCommand
Definition:
ProfilerDisableCommand.php:14
Magento\Developer\Test\Unit\Console\Command\ProfilerDisableCommandTest
Definition:
ProfilerDisableCommandTest.php:19
Magento\Developer\Test\Unit\Console\Command
Definition:
ProfilerDisableCommandTest.php:7
Magento\Developer\Test\Unit\Console\Command\ProfilerDisableCommandTest\setUp
setUp()
Definition:
ProfilerDisableCommandTest.php:71
Magento\Developer\Console\Command\ProfilerDisableCommand\PROFILER_FLAG_FILE
const PROFILER_FLAG_FILE
Definition:
ProfilerDisableCommand.php:19
BP
const BP
Definition:
autoload.php:14
Magento\Framework\Filesystem\Io\File
Definition:
File.php:12