Skip to content

Commit 0188300

Browse files
authored
Merge pull request #281 from thebatclaudio/fix/fix-failing-tests
Fix failing tests and update phpunit.xml
2 parents 43bcfc6 + 4bb8270 commit 0188300

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed

phpunit.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="false"
44
bootstrap="tests/bootstrap.php"
55
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
96
processIsolation="false"
10-
stopOnFailure="false">
7+
stopOnFailure="false"
8+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
9+
cacheDirectory=".phpunit.cache"
10+
backupStaticProperties="false">
1111
<testsuites>
1212
<testsuite name="Application Test Suite">
1313
<directory>./tests/</directory>
1414
</testsuite>
1515
</testsuites>
16-
<filter>
17-
<whitelist processUncoveredFilesFromWhitelist="true">
16+
<source>
17+
<include>
1818
<directory suffix=".php">./src/</directory>
19-
</whitelist>
20-
</filter>
19+
</include>
20+
</source>
2121
</phpunit>

tests/DynamoDb/DynamoDbManagerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use BaoPham\DynamoDb\DynamoDbClientInterface;
88
use BaoPham\DynamoDb\Tests\DynamoDbTestCase;
99
use BaoPham\DynamoDb\DynamoDb\DynamoDbManager;
10+
use BaoPham\DynamoDb\Tests\Mocks\DynamoDbClientMock;
1011

1112
class DynamoDbManagerTest extends DynamoDbTestCase
1213
{
@@ -25,9 +26,9 @@ public function setUp(): void
2526
parent::setUp();
2627

2728
$this->mockedClient = $this
28-
->getMockBuilder(DynamoDbClient::class)
29+
->getMockBuilder(DynamoDbClientMock::class)
2930
->disableOriginalConstructor()
30-
->setMethods(['putItem', 'updateItem', 'deleteItem', 'scan', 'query', 'batchWriteItem'])
31+
->onlyMethods(['putItem', 'updateItem', 'deleteItem', 'scan', 'query', 'batchWriteItem'])
3132
->getMock();
3233

3334
$service = $this->getMockBuilder(DynamoDbClientInterface::class)->getMock();

tests/Mocks/DynamoDbClientMock.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace BaoPham\DynamoDb\Tests\Mocks;
4+
5+
use Aws\DynamoDb\DynamoDbClient;
6+
use Aws\Result;
7+
8+
class DynamoDbClientMock extends DynamoDbClient
9+
{
10+
public function putItem(array $args = []): Result
11+
{
12+
return parent::putItem($args);
13+
}
14+
15+
public function updateItem(array $args = []): Result
16+
{
17+
return parent::updateItem($args);
18+
}
19+
20+
public function deleteItem(array $args = []): Result
21+
{
22+
return parent::deleteItem($args);
23+
}
24+
25+
public function scan(array $args = []): Result
26+
{
27+
return parent::scan($args);
28+
}
29+
30+
public function query(array $args = []): Result
31+
{
32+
return parent::query($args);
33+
}
34+
35+
public function batchWriteItem(array $args = []): Result
36+
{
37+
return parent::batchWriteItem($args);
38+
}
39+
}

0 commit comments

Comments
 (0)