chore: Rename property

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2022-11-20 11:48:05 +01:00
parent de9d500d85
commit ba9a0e6872
4 changed files with 73 additions and 71 deletions

View File

@@ -41,7 +41,7 @@ use SP\Tests\UnitaryTestCase;
*/
class AccountFileRepositoryTest extends UnitaryTestCase
{
private DatabaseInterface|MockObject $databaseInterface;
private DatabaseInterface|MockObject $database;
private AccountFileRepository $accountFileRepository;
/**
@@ -64,7 +64,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn(new QueryResult());
@@ -78,7 +78,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
*/
public function testDeleteByIdBatchWithNoIds()
{
$this->databaseInterface->expects(self::never())
$this->database->expects(self::never())
->method('doQuery');
$this->assertEquals(0, $this->accountFileRepository->deleteByIdBatch([]));
@@ -93,7 +93,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -116,7 +116,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback)
->willReturn(new QueryResult());
@@ -151,7 +151,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -188,7 +188,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback)
->willReturn(new QueryResult());
@@ -217,7 +217,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn(new QueryResult());
@@ -244,7 +244,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doQuery')
->with($callback)
@@ -267,7 +267,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback)
->willReturn(new QueryResult());
@@ -294,7 +294,7 @@ class AccountFileRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -307,11 +307,11 @@ class AccountFileRepositoryTest extends UnitaryTestCase
{
parent::setUp();
$this->databaseInterface = $this->createMock(DatabaseInterface::class);
$this->database = $this->createMock(DatabaseInterface::class);
$queryFactory = new QueryFactory('mysql');
$this->accountFileRepository = new AccountFileRepository(
$this->databaseInterface,
$this->database,
$this->context,
$this->application->getEventDispatcher(),
$queryFactory,

View File

@@ -26,6 +26,7 @@ namespace SP\Tests\Infrastructure\Account\Repositories;
use Aura\SqlQuery\QueryFactory;
use PHPUnit\Framework\Constraint\Callback;
use PHPUnit\Framework\MockObject\MockObject;
use SP\DataModel\Dto\AccountHistoryCreateDto;
use SP\DataModel\ItemSearchData;
use SP\Domain\Account\Out\AccountData;
@@ -42,8 +43,8 @@ use SP\Tests\UnitaryTestCase;
*/
class AccountHistoryRepositoryTest extends UnitaryTestCase
{
private DatabaseInterface $databaseInterface;
private AccountHistoryRepository $accountHistoryRepository;
private DatabaseInterface|MockObject $database;
private AccountHistoryRepository $accountHistoryRepository;
public function testGetById()
{
@@ -57,7 +58,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback)
->willReturn(new QueryResult());
@@ -77,7 +78,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback)
->willReturn(new QueryResult());
@@ -105,7 +106,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn(new QueryResult());
@@ -120,7 +121,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
*/
public function testDeleteByIdBatchWithoutIds()
{
$this->databaseInterface->expects(self::never())
$this->database->expects(self::never())
->method('doQuery');
$this->accountHistoryRepository->deleteByIdBatch([]);
@@ -153,7 +154,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -179,7 +180,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -198,7 +199,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -217,7 +218,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -272,7 +273,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -334,7 +335,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -360,7 +361,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -378,7 +379,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -408,7 +409,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn(new QueryResult());
@@ -422,7 +423,7 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
*/
public function testDeleteByAccountIdBatchWithoutIds()
{
$this->databaseInterface->expects(self::never())
$this->database->expects(self::never())
->method('doQuery');
$this->accountHistoryRepository->deleteByAccountIdBatch([]);
@@ -433,10 +434,10 @@ class AccountHistoryRepositoryTest extends UnitaryTestCase
{
parent::setUp();
$this->databaseInterface = $this->createMock(DatabaseInterface::class);
$this->database = $this->createMock(DatabaseInterface::class);
$this->accountHistoryRepository = new AccountHistoryRepository(
$this->databaseInterface,
$this->database,
$this->context,
$this->application->getEventDispatcher(),
new QueryFactory('mysql')

View File

@@ -26,6 +26,7 @@ namespace SP\Tests\Infrastructure\Account\Repositories;
use Aura\SqlQuery\QueryFactory;
use PHPUnit\Framework\Constraint\Callback;
use PHPUnit\Framework\MockObject\MockObject;
use SP\DataModel\AccountHistoryData;
use SP\DataModel\ItemSearchData;
use SP\Domain\Account\Services\AccountFilterUser;
@@ -47,15 +48,15 @@ use SP\Tests\UnitaryTestCase;
*/
class AccountRepositoryTest extends UnitaryTestCase
{
private DatabaseInterface $databaseInterface;
private AccountRepository $accountRepository;
private AccountFilterUser $accountFilterUser;
private DatabaseInterface|MockObject $database;
private AccountRepository $accountRepository;
private AccountFilterUser $accountFilterUser;
protected function setUp(): void
{
parent::setUp();
$this->databaseInterface = $this->createMock(DatabaseInterface::class);
$this->database = $this->createMock(DatabaseInterface::class);
$queryFactory = new QueryFactory('mysql');
/** @noinspection PhpUnitInvalidMockingEntityInspection */
@@ -68,7 +69,7 @@ class AccountRepositoryTest extends UnitaryTestCase
)
->getMock();
$this->accountRepository = new AccountRepository(
$this->databaseInterface,
$this->database,
$this->context,
$queryFactory,
$this->application->getEventDispatcher(),
@@ -84,7 +85,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback, false)
->willReturn(new QueryResult([new SimpleModel(['num' => 1])]));
@@ -109,7 +110,7 @@ class AccountRepositoryTest extends UnitaryTestCase
->expects(self::once())
->method('buildFilter');
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback, false)
->willReturn(new QueryResult());
@@ -134,7 +135,7 @@ class AccountRepositoryTest extends UnitaryTestCase
->expects(self::once())
->method('buildFilterHistory');
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback, false)
->willReturn(new QueryResult());
@@ -159,7 +160,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -184,7 +185,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -225,7 +226,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -280,7 +281,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -313,7 +314,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -374,7 +375,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -399,7 +400,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -424,7 +425,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -462,7 +463,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -502,7 +503,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -542,7 +543,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -575,7 +576,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -588,7 +589,7 @@ class AccountRepositoryTest extends UnitaryTestCase
*/
public function testUpdateBulkNoFieldsToUpdate()
{
$this->databaseInterface->expects(self::never())
$this->database->expects(self::never())
->method('doQuery');
$this->assertEquals(0, $this->accountRepository->updateBulk(new AccountRequest()));
@@ -606,7 +607,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback)
->willReturn(new QueryResult());
@@ -623,7 +624,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -652,7 +653,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn(new QueryResult());
@@ -666,7 +667,7 @@ class AccountRepositoryTest extends UnitaryTestCase
*/
public function testDeleteByIdBatchWithNoIds()
{
$this->databaseInterface->expects(self::never())
$this->database->expects(self::never())
->method('doQuery');
$this->assertEquals(0, $this->accountRepository->deleteByIdBatch([]));
@@ -692,7 +693,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -711,7 +712,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -737,7 +738,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -762,7 +763,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -784,7 +785,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -813,7 +814,7 @@ class AccountRepositoryTest extends UnitaryTestCase
->expects(self::once())
->method('buildFilter');
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -840,7 +841,7 @@ class AccountRepositoryTest extends UnitaryTestCase
->expects(self::once())
->method('buildFilter');
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -869,7 +870,7 @@ class AccountRepositoryTest extends UnitaryTestCase
->expects(self::once())
->method('buildFilter');
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)
@@ -887,7 +888,7 @@ class AccountRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doSelect')
->with($callback)

View File

@@ -39,7 +39,7 @@ use SP\Tests\UnitaryTestCase;
*/
class AccountToFavoriteRepositoryTest extends UnitaryTestCase
{
private MockObject|DatabaseInterface $databaseInterface;
private MockObject|DatabaseInterface $database;
private AccountToFavoriteRepository $accountToFavoriteRepository;
public function testGetForUserId()
@@ -56,7 +56,7 @@ class AccountToFavoriteRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doSelect')
->with($callback)
->willReturn(new QueryResult());
@@ -83,7 +83,7 @@ class AccountToFavoriteRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface
$this->database
->expects(self::once())
->method('doQuery')
->with($callback)
@@ -115,7 +115,7 @@ class AccountToFavoriteRepositoryTest extends UnitaryTestCase
}
);
$this->databaseInterface->expects(self::once())
$this->database->expects(self::once())
->method('doQuery')
->with($callback)
->willReturn($expected);
@@ -127,11 +127,11 @@ class AccountToFavoriteRepositoryTest extends UnitaryTestCase
{
parent::setUp();
$this->databaseInterface = $this->createMock(DatabaseInterface::class);
$this->database = $this->createMock(DatabaseInterface::class);
$queryFactory = new QueryFactory('mysql');
$this->accountToFavoriteRepository = new AccountToFavoriteRepository(
$this->databaseInterface,
$this->database,
$this->context,
$this->application->getEventDispatcher(),
$queryFactory,