Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/data
.phpunit.result.cache
composer.lock
.env
.env
/.env.local
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ docker-compose build
docker-compose run --rm dev composer install --no-scripts
```

Create `.env` file with following contents:
Create `.env.local` file with following contents:

```shell
KBC_SYNC_ACTIONS_URL=https://sync-actions.keboola.com/
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"keboola/php-temp": "^2.0",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5",
"symfony/process": "^5.0"
"symfony/process": "^5.0",
"symfony/dotenv": "^5.0"
},
"autoload": {
"psr-4": {
Expand All @@ -25,7 +26,7 @@
},
"autoload-dev": {
"psr-4": {
"Keboola\\SyncActionsClient\\Tests\\": "tests/phpunit/"
"Keboola\\SyncActionsClient\\Tests\\": "tests/"
}
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ services:
environment:
- KBC_SYNC_ACTIONS_URL
- KBC_TOKEN
env_file:
- .env
- .env.local
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/phpunit/bootstrap.php">
bootstrap="tests/bootstrap.php">
<testsuite name="Main Test Suite">
<directory>tests/phpunit</directory>
<directory>tests</directory>
</testsuite>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Keboola\ExDbSnowflake\Tests;
namespace Keboola\SyncActionsClient\Tests;

use Keboola\SyncActionsClient\ActionData;
use Keboola\SyncActionsClient\Client;
Expand Down Expand Up @@ -56,8 +56,8 @@ public function testInvalidComponent(): void
$client = $this->getClient();

self::expectException(ClientException::class);
self::expectExceptionMessage('Component unexistComponent not found');
$client->callAction(new ActionData('unexistComponent', 'unexistAction', []));
self::expectExceptionMessage('Component \"non-existent-component\" not found');
$client->callAction(new ActionData('non-existent-component', 'unexistAction', []));
}

public function testInvalidAction(): void
Expand All @@ -66,10 +66,10 @@ public function testInvalidAction(): void

self::expectException(ClientException::class);
self::expectExceptionMessage(sprintf(
'Action \"unexistAction\" not defined for component \"%s\".',
'Action \"non-existent-action\" not defined for component \"%s\".',
self::COMPONENT_ID,
));
$client->callAction(new ActionData(self::COMPONENT_ID, 'unexistAction', []));
$client->callAction(new ActionData(self::COMPONENT_ID, 'non-existent-action', []));
}

private function getClient(): Client
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

use Symfony\Component\Dotenv\Dotenv;

require __DIR__ . '/../vendor/autoload.php';

if (file_exists(dirname(__DIR__).'/.env.local')) {
(new Dotenv())->usePutenv(true)->bootEnv(dirname(__DIR__).'/.env.local', 'dev', []);
}

$requiredEnvs = ['KBC_SYNC_ACTIONS_URL', 'KBC_TOKEN'];

foreach ($requiredEnvs as $env) {
if (empty(getenv($env))) {
throw new Exception(sprintf('The "%s" environment variable is empty.', $env));
}
}
5 changes: 0 additions & 5 deletions tests/phpunit/bootstrap.php

This file was deleted.