Skip to content

Commit

Permalink
Merge pull request #281 from thebatclaudio/fix/fix-failing-tests
Browse files Browse the repository at this point in the history
Fix failing tests and update phpunit.xml
  • Loading branch information
nelson6e65 authored Apr 3, 2024
2 parents 43bcfc6 + 4bb8270 commit 0188300
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 12 deletions.
20 changes: 10 additions & 10 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<source>
<include>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</include>
</source>
</phpunit>
5 changes: 3 additions & 2 deletions tests/DynamoDb/DynamoDbManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use BaoPham\DynamoDb\DynamoDbClientInterface;
use BaoPham\DynamoDb\Tests\DynamoDbTestCase;
use BaoPham\DynamoDb\DynamoDb\DynamoDbManager;
use BaoPham\DynamoDb\Tests\Mocks\DynamoDbClientMock;

class DynamoDbManagerTest extends DynamoDbTestCase
{
Expand All @@ -25,9 +26,9 @@ public function setUp(): void
parent::setUp();

$this->mockedClient = $this
->getMockBuilder(DynamoDbClient::class)
->getMockBuilder(DynamoDbClientMock::class)
->disableOriginalConstructor()
->setMethods(['putItem', 'updateItem', 'deleteItem', 'scan', 'query', 'batchWriteItem'])
->onlyMethods(['putItem', 'updateItem', 'deleteItem', 'scan', 'query', 'batchWriteItem'])
->getMock();

$service = $this->getMockBuilder(DynamoDbClientInterface::class)->getMock();
Expand Down
39 changes: 39 additions & 0 deletions tests/Mocks/DynamoDbClientMock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace BaoPham\DynamoDb\Tests\Mocks;

use Aws\DynamoDb\DynamoDbClient;
use Aws\Result;

class DynamoDbClientMock extends DynamoDbClient
{
public function putItem(array $args = []): Result
{
return parent::putItem($args);
}

public function updateItem(array $args = []): Result
{
return parent::updateItem($args);
}

public function deleteItem(array $args = []): Result
{
return parent::deleteItem($args);
}

public function scan(array $args = []): Result
{
return parent::scan($args);
}

public function query(array $args = []): Result
{
return parent::query($args);
}

public function batchWriteItem(array $args = []): Result
{
return parent::batchWriteItem($args);
}
}

0 comments on commit 0188300

Please sign in to comment.