security: faza 1 - usuniecie debug logu tpay, naprawa SQL i usun rb.php
- ShopOrderController: usunieto file_put_contents do tpay.txt (ujawnial dane platnicze)
- ShopOrderController: hardcoded sekret HotPay przeniesiony do stałej HOTPAY_HASH_SEED
- IntegrationsRepository: zastapiono raw SQL query('SELECT * FROM $table') metodą Medoo select()
- index.php + admin/index.php: usunieto RedBeanPHP (rb.php) - biblioteka byla ladowana ale nieuzywana
- libraries/rb.php: usunieto plik (536 KB, zero uzyc w kodzie aplikacji)
- Testy IntegrationsRepository zaktualizowane do nowego API (select zamiast query)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,20 +17,14 @@ class IntegrationsRepositoryTest extends TestCase
|
||||
|
||||
public function testGetSettingsReturnsArray(): void
|
||||
{
|
||||
$stmt = $this->createMock(\PDOStatement::class);
|
||||
$stmt->expects($this->once())
|
||||
->method('fetchAll')
|
||||
->with(\PDO::FETCH_ASSOC)
|
||||
$this->mockDb->expects($this->once())
|
||||
->method('select')
|
||||
->with('pp_shop_apilo_settings', ['name', 'value'])
|
||||
->willReturn([
|
||||
['name' => 'client-id', 'value' => 'abc123'],
|
||||
['name' => 'client-secret', 'value' => 'secret'],
|
||||
]);
|
||||
|
||||
$this->mockDb->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT * FROM pp_shop_apilo_settings')
|
||||
->willReturn($stmt);
|
||||
|
||||
$settings = $this->repository->getSettings('apilo');
|
||||
|
||||
$this->assertIsArray($settings);
|
||||
@@ -144,10 +138,7 @@ class IntegrationsRepositoryTest extends TestCase
|
||||
|
||||
public function testApiloGetAccessTokenReturnsNullWithoutSettings(): void
|
||||
{
|
||||
$stmt = $this->createMock(\PDOStatement::class);
|
||||
$stmt->method('fetchAll')->willReturn([]);
|
||||
|
||||
$this->mockDb->method('query')->willReturn($stmt);
|
||||
$this->mockDb->method('select')->willReturn([]);
|
||||
|
||||
$this->assertNull($this->repository->apiloGetAccessToken());
|
||||
}
|
||||
@@ -184,16 +175,10 @@ class IntegrationsRepositoryTest extends TestCase
|
||||
|
||||
public function testApiloFetchListResultReturnsDetailedErrorWhenConfigMissing(): void
|
||||
{
|
||||
$stmt = $this->createMock(\PDOStatement::class);
|
||||
$stmt->expects($this->once())
|
||||
->method('fetchAll')
|
||||
->with(\PDO::FETCH_ASSOC)
|
||||
->willReturn([]);
|
||||
|
||||
$this->mockDb->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT * FROM pp_shop_apilo_settings')
|
||||
->willReturn($stmt);
|
||||
->method('select')
|
||||
->with('pp_shop_apilo_settings', ['name', 'value'])
|
||||
->willReturn([]);
|
||||
|
||||
$result = $this->repository->apiloFetchListResult('payment');
|
||||
|
||||
@@ -204,16 +189,10 @@ class IntegrationsRepositoryTest extends TestCase
|
||||
|
||||
public function testApiloIntegrationStatusReturnsMissingConfigMessage(): void
|
||||
{
|
||||
$stmt = $this->createMock(\PDOStatement::class);
|
||||
$stmt->expects($this->once())
|
||||
->method('fetchAll')
|
||||
->with(\PDO::FETCH_ASSOC)
|
||||
->willReturn([]);
|
||||
|
||||
$this->mockDb->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT * FROM pp_shop_apilo_settings')
|
||||
->willReturn($stmt);
|
||||
->method('select')
|
||||
->with('pp_shop_apilo_settings', ['name', 'value'])
|
||||
->willReturn([]);
|
||||
|
||||
$status = $this->repository->apiloIntegrationStatus();
|
||||
|
||||
@@ -242,25 +221,20 @@ class IntegrationsRepositoryTest extends TestCase
|
||||
|
||||
public function testSettingsTableMapping(): void
|
||||
{
|
||||
// Verify apilo maps correctly
|
||||
$stmt = $this->createMock(\PDOStatement::class);
|
||||
$stmt->method('fetchAll')->willReturn([]);
|
||||
$this->mockDb->method('query')
|
||||
->with($this->stringContains('pp_shop_apilo_settings'))
|
||||
->willReturn($stmt);
|
||||
$this->mockDb->method('select')
|
||||
->with('pp_shop_apilo_settings', ['name', 'value'])
|
||||
->willReturn([]);
|
||||
|
||||
$this->assertIsArray($this->repository->getSettings('apilo'));
|
||||
}
|
||||
|
||||
public function testShopproProviderWorks(): void
|
||||
{
|
||||
$stmt = $this->createMock(\PDOStatement::class);
|
||||
$stmt->method('fetchAll')->willReturn([
|
||||
['name' => 'domain', 'value' => 'test.com'],
|
||||
]);
|
||||
$this->mockDb->method('query')
|
||||
->with($this->stringContains('pp_shop_shoppro_settings'))
|
||||
->willReturn($stmt);
|
||||
$this->mockDb->method('select')
|
||||
->with('pp_shop_shoppro_settings', ['name', 'value'])
|
||||
->willReturn([
|
||||
['name' => 'domain', 'value' => 'test.com'],
|
||||
]);
|
||||
|
||||
$settings = $this->repository->getSettings('shoppro');
|
||||
$this->assertSame('test.com', $settings['domain']);
|
||||
|
||||
Reference in New Issue
Block a user