Skip to content

Commit

Permalink
Merge pull request #24 from Fighter90/symfony6-support
Browse files Browse the repository at this point in the history
Added symfony 6 support
  • Loading branch information
lalatechla authored Feb 26, 2024
2 parents 1fcf74d + 4683536 commit 23a7077
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 57 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
- { os: ubuntu-latest, php: 7.3, experimental: false}
- { os: ubuntu-latest, php: 7.4, experimental: false}
- { os: ubuntu-latest, php: 8.0, experimental: false}
- { os: ubuntu-latest, php: 8.1, experimental: true}
- { os: ubuntu-latest, php: 8.1, experimental: false }
- { os: ubuntu-latest, php: 8.2, packages: symfony/symfony=6.*, experimental: true }
- { os: ubuntu-latest, php: 7.1, packages: symfony/symfony=3.4.*, experimental: false}
- { os: ubuntu-latest, php: 7.1, packages: symfony/symfony=4.0.*, experimental: false}
- { os: ubuntu-latest, php: 8.0, packages: symfony/symfony=4.*, experimental: false}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ vendor/
build/
target/
.php_cs.cache
.idea/
21 changes: 12 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@
"doctrine/dbal": "^2.3",
"doctrine/doctrine-bundle": "~1.5 || ^2.0",
"doctrine/orm": "~2.4",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0 || ^10.0",
"predis/predis": "^1.1",
"symfony/browser-kit": "~2.8 || ~3.0 || ~4.0 || ^5.0",
"symfony/config": "~2.8 || ~3.0 || ~4.0 || ^5.0",
"symfony/dependency-injection": "~2.8 || ~3.0 || ~4.0 || ^5.0",
"symfony/framework-bundle": "~2.8 || ~3.0 || ~4.0 || ^5.0",
"symfony/http-kernel": "~2.8 || ~3.0 || ~4.0 || ^5.0",
"symfony/routing": "~2.8 || ~3.0 || ~4.0 || ^5.0",
"symfony/stopwatch": "~2.8 || ~3.0 || ~4.0 || ^5.0",
"symfony/yaml": "~2.8 || ~3.0 || ~4.0 || ^5.0"
"symfony/browser-kit": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/config": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/dependency-injection": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/framework-bundle": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/http-kernel": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/routing": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/stopwatch": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/yaml": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/dom-crawler": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0",
"symfony/monolog-bundle": "~2.0 || ~3.0",
"masterminds/html5": "^2.6"
},
"autoload": {
"psr-4": {
Expand Down
58 changes: 23 additions & 35 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="./vendor/autoload.php">

<testsuites>
<testsuite name="Lamoda metrics tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<php>
<ini name="error_reporting" value="-1" />
<env name="SHELL_VERBOSITY" value="-1" />
<env name="KERNEL_CLASS" value="Lamoda\Metric\MetricBundle\Tests\Fixtures\TestKernel" />
<env name="APP_ENV" value="test" />
<env name="APP_DEBUG" value="1" />
</php>

<filter>
<whitelist>
<directory>./src/</directory>
<exclude>
<directory>./build/</directory>
<directory>./vendor/</directory>
<directory>./tests/</directory>
</exclude>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="./vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Lamoda metrics tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1"/>
<env name="SHELL_VERBOSITY" value="-1"/>
<env name="KERNEL_CLASS" value="Lamoda\Metric\MetricBundle\Tests\Fixtures\TestKernel"/>
<env name="APP_ENV" value="test"/>
<env name="APP_DEBUG" value="1"/>
</php>
<source>
<include>
<directory>./src/</directory>
</include>
<exclude>
<directory>./build/</directory>
<directory>./vendor/</directory>
<directory>./tests/</directory>
</exclude>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/Adapters/Redis/RedisConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testAdjustMetric(): void
->expects($this->once())
->method('hincrbyfloat')
->with(self::METRICS_KEY, $expectedField, $value)
->willReturn(17);
->willReturn(17.0);

$actual = $this->redisConnection->adjustMetric('test', $value, ['severity' => 'high']);
self::assertEquals(17, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\KernelInterface;

abstract class AbstractMetricBundleTest extends WebTestCase
abstract class AbstractMetricBundleTestClass extends WebTestCase
{
/** @var Client */
protected static $client;
Expand All @@ -33,7 +34,7 @@ protected static function getEntityManager(): EntityManagerInterface
return static::$em;
}

protected static function createKernel(array $options = [])
protected static function createKernel(array $options = []): KernelInterface
{
$kernel = parent::createKernel($options);
$fs = new Filesystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
final class ConfigurationTest extends TestCase
{
public function getSamples(): array
public static function getSamples(): array
{
$files = glob(__DIR__ . '/valid_config_samples/*.yml');

Expand Down
10 changes: 5 additions & 5 deletions tests/MetricBundle/Fixtures/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
final class TestKernel extends Kernel
{
/** {@inheritdoc} */
public function registerBundles()
public function registerBundles(): iterable
{
return [
new FrameworkBundle(),
Expand All @@ -27,22 +27,22 @@ public function registerContainerConfiguration(LoaderInterface $loader)
$loader->load(__DIR__ . '/config.yml');
}

public function getRootDir()
public function getRootDir(): string
{
return __DIR__;
}

public function getProjectDir()
public function getProjectDir(): string
{
return __DIR__;
}

public function getCacheDir()
public function getCacheDir(): string
{
return __DIR__ . '/../../../build/cache';
}

public function getLogDir()
public function getLogDir(): string
{
return __DIR__ . '/../../../build/logs';
}
Expand Down
4 changes: 2 additions & 2 deletions tests/MetricBundle/MetricRespondingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* @covers \Lamoda\Metric\MetricBundle\DependencyInjection\DefinitionFactory\Source
* @runTestsInSeparateProcesses
*/
final class MetricRespondingTest extends AbstractMetricBundleTest
final class MetricRespondingTest extends AbstractMetricBundleTestClass
{
public function getTelegrafTestRoutes(): array
public static function getTelegrafTestRoutes(): array
{
return [
'basic' => ['/metrics/telegraf_json'],
Expand Down
2 changes: 1 addition & 1 deletion tests/MetricBundle/StoredMetricMutatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @covers \Lamoda\Metric\MetricBundle\DependencyInjection\DefinitionFactory\Source
* @runTestsInSeparateProcesses
*/
final class StoredMetricMutatorTest extends AbstractMetricBundleTest
final class StoredMetricMutatorTest extends AbstractMetricBundleTestClass
{
public function testAdjustableMetrics(): void
{
Expand Down

0 comments on commit 23a7077

Please sign in to comment.