Skip to content

Commit

Permalink
IBX-1489: Provided integration test for Installers for PHP8
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p committed Nov 23, 2021
1 parent f5393e7 commit 56df84d
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- '7.3'
- '7.4'
composer_options: [ "" ]
include:
- php: '8.0'
composer_options: "--ignore-platform-req php"

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -82,6 +85,9 @@ jobs:
- '7.3'
- '7.4'
composer_options: [ "" ]
include:
- php: '8.0'
composer_options: "--ignore-platform-req php"

steps:
- uses: actions/checkout@v2
Expand All @@ -108,3 +114,60 @@ jobs:
DATABASE_URL: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb?server_version=10"
# Required by old repository tests
DATABASE: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb"

integration-tests-mysql:
name: MySQL integration tests
needs: tests
services:
mysql:
image: mysql:8.0
ports:
- 3306/tcp
env:
MYSQL_RANDOM_ROOT_PASSWORD: true
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_DATABASE: testdb
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
--tmpfs=/var/lib/mysql
runs-on: "ubuntu-20.04"
timeout-minutes: 20

strategy:
matrix:
php:
- '7.3'
- '7.4'
composer_options: [ "" ]
include:
- php: '8.0'
composer_options: "--ignore-platform-req php"

steps:
- uses: actions/checkout@v2

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: pdo_mysql, gd
tools: cs2pr

- uses: "ramsey/composer-install@v1"
with:
dependency-versions: "highest"
composer-options: "${{ matrix.composer_options }}"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run integration test suite vs MySQL
run: composer run-script integration
env:
DATABASE_URL: "mysql://mysql:[email protected]:${{ job.services.mysql.ports[3306] }}/testdb"
DATABASE: "mysql://mysql:[email protected]:${{ job.services.mysql.ports[3306] }}/testdb"
25 changes: 25 additions & 0 deletions tests/integration/Installer/Installer/CoreInstallerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Ibexa\Tests\Integration\Installer\Installer;

use EzSystems\PlatformInstallerBundle\Installer\CoreInstaller;
use Ibexa\Tests\Integration\Installer\TestCase;
use Symfony\Component\Console\Output\NullOutput;

final class CoreInstallerTest extends TestCase
{
/** @var \EzSystems\PlatformInstallerBundle\Installer\CoreInstaller */
private $installer;

protected function setUp(): void
{
self::bootKernel();
$this->installer = self::getServiceByClassName(CoreInstaller::class);
}

public function testImportSchema(): void
{
$this->installer->setOutput(new NullOutput());
$this->installer->importSchema();
}
}
14 changes: 14 additions & 0 deletions tests/integration/Installer/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);

namespace Ibexa\Tests\Integration\Installer;

use Ibexa\Contracts\Core\Test\IbexaKernelTestCase;

abstract class TestCase extends IbexaKernelTestCase
{
protected static function getKernelClass(): string
{
return TestKernel::class;
}
}
27 changes: 27 additions & 0 deletions tests/integration/Installer/TestKernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);

namespace Ibexa\Tests\Integration\Installer;

use EzSystems\DoctrineSchemaBundle\DoctrineSchemaBundle;
use EzSystems\PlatformInstallerBundle\EzSystemsPlatformInstallerBundle;
use EzSystems\PlatformInstallerBundle\Installer\CoreInstaller;
use Ibexa\Contracts\Core\Test\IbexaTestKernel;

final class TestKernel extends IbexaTestKernel
{
public function registerBundles(): iterable
{
yield from parent::registerBundles();

yield new DoctrineSchemaBundle();
yield new EzSystemsPlatformInstallerBundle();
}

protected static function getExposedServicesByClass(): iterable
{
yield from parent::getExposedServicesByClass();

yield CoreInstaller::class;
}
}

0 comments on commit 56df84d

Please sign in to comment.