Move from entity mock, to direct use of class instance and setters
use PHPUnit\Framework\TestCase;
final class SomeFileTest extends TestCase
{
public function test()
{
- $tableMock = $this->createMock(Table::class);
-
- $tableMock->expects(self::once())
- ->method('isLocked')
- ->willReturn(true);
+ $table = new Table();
+ $table->setLocked(true);
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\EntityDocumentCreateMockToDirectNewRector;
return RectorConfig::configure()
->withRules([
EntityDocumentCreateMockToDirectNewRector::class,
]);