Skip to content

Commit

Permalink
dropping behat tests from PdoEventSourcing module (#143)
Browse files Browse the repository at this point in the history
phpunit config cleanups
dropping behat tests from PdoEventSourcing module and rewriting them using Ecotone Test Support
using pcov for coverage report

Co-authored-by: Dariusz Gafka <dgafka.mail@gmail.com>
  • Loading branch information
unixslayer and dgafka authored Jun 11, 2023
1 parent ea95089 commit 074f372
Show file tree
Hide file tree
Showing 71 changed files with 1,314 additions and 1,366 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/split-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
coverage: pcov

- name: Enable merge-plugin
run: composer global config --no-interaction allow-plugins.wikimedia/composer-merge-plugin true && composer global require wikimedia/composer-merge-plugin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-monorepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
coverage: pcov

- uses: actions/checkout@v2

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ packages/cache
auth.json
./config.json
.env
.phpbench/
.phpbench/
phpunit.xml
3 changes: 2 additions & 1 deletion _PackageTemplate/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ tests/coverage
!tests/coverage/.gitkeep
file
.phpunit.result.cache
composer.lock
composer.lock
phpunit.xml
40 changes: 0 additions & 40 deletions _PackageTemplate/local_packages.json

This file was deleted.

35 changes: 0 additions & 35 deletions _PackageTemplate/phpunit.xml

This file was deleted.

20 changes: 20 additions & 0 deletions _PackageTemplate/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="true"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<text outputFile="php://stdout" showOnlySummary="true" />
</report>
</coverage>
<testsuites>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
5 changes: 0 additions & 5 deletions behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ default:
- packages/Amqp/tests/Behat/features
contexts:
- Test\Ecotone\Amqp\Behat\Bootstrap\DomainContext
event-sourcing:
paths:
- packages/PdoEventSourcing/tests/Behat/features
contexts:
- Test\Ecotone\EventSourcing\Behat\Bootstrap\DomainContext
symfony:
extensions:
FriendsOfBehat\SymfonyExtension:
Expand Down
3 changes: 2 additions & 1 deletion packages/Amqp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ tests/coverage
!tests/coverage/.gitkeep
file
.phpunit.result.cache
composer.lock
composer.lock
phpunit.xml
35 changes: 0 additions & 35 deletions packages/Amqp/phpunit.xml

This file was deleted.

20 changes: 20 additions & 0 deletions packages/Amqp/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="true"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<text outputFile="php://stdout" showOnlySummary="true" />
</report>
</coverage>
<testsuites>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
3 changes: 2 additions & 1 deletion packages/Dbal/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ tests/coverage
!tests/coverage/.gitkeep
file
.phpunit.result.cache
composer.lock
composer.lock
phpunit.xml
35 changes: 0 additions & 35 deletions packages/Dbal/phpunit.xml

This file was deleted.

20 changes: 20 additions & 0 deletions packages/Dbal/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="true"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<text outputFile="php://stdout" showOnlySummary="true" />
</report>
</coverage>
<testsuites>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
8 changes: 8 additions & 0 deletions packages/Ecotone/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea/
vendor/
bin/
tests/coverage
!tests/coverage/.gitkeep
.phpunit.result.cache
composer.lock
phpunit.xml
33 changes: 0 additions & 33 deletions packages/Ecotone/phpunit.xml

This file was deleted.

20 changes: 20 additions & 0 deletions packages/Ecotone/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="true"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<text outputFile="php://stdout" showOnlySummary="true" />
</report>
</coverage>
<testsuites>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
31 changes: 31 additions & 0 deletions packages/Ecotone/src/Lite/Test/FlowTestSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Ecotone\Lite\Test;

use Ecotone\EventSourcing\Config\EventSourcingModule;
use Ecotone\EventSourcing\EventStore;
use Ecotone\EventSourcing\ProjectionManager;
use Ecotone\Messaging\Config\ConfiguredMessagingSystem;
Expand Down Expand Up @@ -163,6 +164,36 @@ public function triggerProjection(string $projectionName): self
return $this;
}

public function initializeProjection(string $projectionName): self
{
$this->getGateway(ProjectionManager::class)->initializeProjection($projectionName);

return $this;
}

public function stopProjection(string $projectionName): self
{
$this->getGateway(ProjectionManager::class)->stopProjection($projectionName);

return $this;
}

public function resetProjection(string $projectionName): self
{
$this->getGateway(ProjectionManager::class)->resetProjection($projectionName);

return $this;
}

public function deleteProjection(string $projectionName): self
{
// fixme Calling ProjectionManager to delete the projection throws `Header with name ecotone.eventSourcing.manager.deleteEmittedEvents does not exists` exception
//$this->getGateway(ProjectionManager::class)->deleteProjection($projectionName);
$this->configuredMessagingSystem->runConsoleCommand('ecotone:es:delete-projection', ['name' => $projectionName]);

return $this;
}

/**
* @return mixed[]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Ecotone\Messaging\Attribute\ServiceContext;

class CorrectClass
class CorrectMessagingClass
{
#[ServiceContext]
public function someExtension(): array
Expand Down
Loading

0 comments on commit 074f372

Please sign in to comment.