Skip to content

Commit 1c2d999

Browse files
committed
MC-29405: PHPStan: "Class does not have a constructor and must be instantiated without any parameters" errors
1 parent 4527d76 commit 1c2d999

File tree

5 files changed

+5
-33
lines changed

5 files changed

+5
-33
lines changed

app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/BillingTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ class BillingTest extends TestCase
2323

2424
protected function setUp(): void
2525
{
26-
$logger = $this->getMockBuilder(LoggerInterface::class)
27-
->getMock();
28-
/** @var LoggerInterface $logger */
29-
$this->testable = new Billing($logger);
26+
$this->testable = new Billing();
3027
}
3128

3229
public function testBeforeSave()

app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/ShippingTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ class ShippingTest extends TestCase
2323

2424
protected function setUp(): void
2525
{
26-
$logger = $this->getMockBuilder(LoggerInterface::class)
27-
->getMock();
28-
/** @var LoggerInterface $logger */
29-
$this->testable = new Shipping($logger);
26+
$this->testable = new Shipping();
3027
}
3128

3229
public function testBeforeSave()

app/code/Magento/Theme/Test/Unit/Block/Adminhtml/Design/Config/Edit/SaveButtonTest.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,9 @@ class SaveButtonTest extends TestCase
2020
*/
2121
protected $block;
2222

23-
/**
24-
* @var Context|MockObject
25-
*/
26-
protected $context;
27-
2823
protected function setUp(): void
2924
{
30-
$this->initContext();
31-
32-
$this->block = new SaveButton($this->context);
25+
$this->block = new SaveButton();
3326
}
3427

3528
public function testGetButtonData()
@@ -41,18 +34,4 @@ public function testGetButtonData()
4134
$this->assertArrayHasKey('data_attribute', $result);
4235
$this->assertIsArray($result['data_attribute']);
4336
}
44-
45-
protected function initContext()
46-
{
47-
$this->urlBuilder = $this->getMockBuilder(UrlInterface::class)
48-
->disableOriginalConstructor()
49-
->getMockForAbstractClass();
50-
51-
$this->context = $this->getMockBuilder(Context::class)
52-
->disableOriginalConstructor()
53-
->getMock();
54-
$this->context->expects($this->any())
55-
->method('getUrlBuilder')
56-
->willReturn($this->urlBuilder);
57-
}
5837
}

lib/internal/Magento/Framework/Amqp/Test/Unit/Topology/QueueInstallerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class QueueInstallerTest extends TestCase
1616
{
1717
public function testInstall()
1818
{
19-
$bindingInstaller = $this->getMockForAbstractClass(QueueConfigItemInterface::class);
20-
$model = new QueueInstaller($bindingInstaller);
19+
$model = new QueueInstaller();
2120
$channel = $this->createMock(AMQPChannel::class);
2221

2322
$queue = $this->getMockForAbstractClass(QueueConfigItemInterface::class);

setup/src/Magento/Setup/Module/Dependency/ServiceLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function getCircularDependenciesReportBuilder()
9595
self::$circularDependenciesReportBuilder = new CircularReport\Builder(
9696
self::getComposerJsonParser(),
9797
new CircularReport\Writer(self::getCsvWriter()),
98-
new CircularTool([], null)
98+
new CircularTool()
9999
);
100100
}
101101
return self::$circularDependenciesReportBuilder;

0 commit comments

Comments
 (0)