Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests and update phpunit.xml #281

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}