Skip to content

Commit 5395498

Browse files
authored
Merge pull request #6033 from samsonasik/apply-remove-mock
[Rector] Apply PHPUnitSetList::REMOVE_MOCKS
2 parents 346c18f + b2f228f commit 5395498

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
LevelSetList::UP_TO_PHP_74,
5858
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
5959
PHPUnitSetList::PHPUNIT_80,
60+
PHPUnitSetList::REMOVE_MOCKS,
6061
]);
6162

6263
$rectorConfig->parallel();

tests/system/Database/Forge/CreateTableTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testCreateTableWithExists()
2727
->setConstructorArgs([[]])
2828
->onlyMethods(['listTables'])
2929
->getMock();
30-
$dbMock->expects($this->any())
30+
$dbMock
3131
->method('listTables')
3232
->willReturn(['foo']);
3333

@@ -53,7 +53,7 @@ public function testCreateTableWithDefaultRawSql()
5353
->setConstructorArgs([[]])
5454
->onlyMethods(['query'])
5555
->getMock();
56-
$dbMock->expects($this->any())
56+
$dbMock
5757
->method('query')
5858
->with($sql)
5959
->willReturn(true);

tests/system/Debug/Toolbar/Collectors/DatabaseTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ final class DatabaseTest extends CIUnitTestCase
2323
public function testDisplay(): void
2424
{
2525
/** @var MockObject&Query $query */
26-
$query = $this->getMockBuilder(Query::class)
27-
->disableOriginalConstructor()
28-
->getMock();
26+
$query = $this->createMock(Query::class);
2927

3028
// set mock returns
3129
$query->method('getQuery')->willReturn('SHOW TABLES;');
@@ -39,7 +37,7 @@ public function testDisplay(): void
3937

4038
$this->assertSame('1234.56 ms', $queries[0]['duration']);
4139
$this->assertSame('<strong>SHOW</strong> TABLES;', $queries[0]['sql']);
42-
$this->assertSame(clean_path(__FILE__) . ':35', $queries[0]['trace-file']);
40+
$this->assertSame(clean_path(__FILE__) . ':33', $queries[0]['trace-file']);
4341

4442
foreach ($queries[0]['trace'] as $i => $trace) {
4543
// since we added the index numbering

0 commit comments

Comments
 (0)