Skip to content
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/testo.php export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php_cs.dist.php export-ignore
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/phpunit.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/testo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
pull_request: null
push:
branches:
- 1.x

name: testo

jobs:
testo:
uses: spiral/gh-actions/.github/workflows/testo.yml@master
with:
os: >-
['ubuntu-latest']
dependencies: >-
['lowest', 'highest']
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.idea
.php_cs
.php_cs.cache
.phpunit.cache
.phpunit.result.cache
build
composer.lock
coverage
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![PHP Version Require](https://poser.pugx.org/roadrunner-php/version-checker/require/php)](https://packagist.org/packages/roadrunner-php/version-checker)
[![Latest Stable Version](https://poser.pugx.org/roadrunner-php/version-checker/v/stable)](https://packagist.org/packages/roadrunner-php/version-checker)
[![phpunit](https://github.com/roadrunner-php/version-checker/actions/workflows/phpunit.yml/badge.svg)](https://github.com/roadrunner-php/version-checker/actions)
[![testo](https://github.com/roadrunner-php/version-checker/actions/workflows/testo.yml/badge.svg)](https://github.com/roadrunner-php/version-checker/actions)
[![psalm](https://github.com/roadrunner-php/version-checker/actions/workflows/psalm.yml/badge.svg)](https://github.com/roadrunner-php/version-checker/actions)
[![Codecov](https://codecov.io/gh/roadrunner-php/version-checker/branch/master/graph/badge.svg)](https://codecov.io/gh/roadrunner-php/version-checker)
[![Total Downloads](https://poser.pugx.org/roadrunner-php/version-checker/downloads)](https://packagist.org/roadrunner-php/version-checker/phpunit)
Expand All @@ -12,7 +12,7 @@

Make sure that your server is configured with following PHP version and extensions:

- PHP 8.0+
- PHP 8.2+

## Installation

Expand Down
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
"homepage": "https://github.com/roadrunner-php/version-checker",
"license": "MIT",
"require": {
"php": "^8.0",
"php": "^8.2",
"symfony/process": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"composer-runtime-api": "^2.0",
"composer/semver": "^3.3"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^10.0",
"vimeo/psalm": "^5.9",
"friendsofphp/php-cs-fixer": "^3.8"
"friendsofphp/php-cs-fixer": "^3.8",
"mockery/mockery": "^1.6",
"testo/bridge-mockery": "^0.1.2",
"testo/testo": "^0.10.55",
"vimeo/psalm": "^6 || ^7"
},
"autoload": {
"psr-4": {
Expand All @@ -30,7 +32,7 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"test": "vendor/bin/testo",
"psalm": "vendor/bin/psalm --config=psalm.xml ./src",
"cs": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -vvv --dry-run --using-cache=no"
},
Expand Down
34 changes: 0 additions & 34 deletions phpunit.xml

This file was deleted.

18 changes: 18 additions & 0 deletions testo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Testo\Application\Config\ApplicationConfig;
use Testo\Application\Config\SuiteConfig;
use Testo\Bridge\Mockery\MockeryPlugin;

return new ApplicationConfig(
src: ['src'],
suites: [
new SuiteConfig(
name: 'Unit',
location: ['tests/src/Unit'],
),
],
plugins: [new MockeryPlugin()],
);
19 changes: 9 additions & 10 deletions tests/src/Unit/Composer/PackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,32 @@

namespace RoadRunner\VersionChecker\Tests\Unit\Composer;

use PHPUnit\Framework\TestCase;
use RoadRunner\VersionChecker\Composer\Package;
use Testo\Assert;
use Testo\Data\DataProvider;
use Testo\Test;

final class PackageTest extends TestCase
#[Test]
final class PackageTest
{
/**
* @dataProvider isSupportedVersionDataProvider
*/
#[DataProvider('isSupportedVersionDataProvider')]
public function testIsSupportedVersion(string $version, bool $expected): void
{
$package = new Package();
$ref = new \ReflectionMethod($package, 'isSupportedVersion');
$ref->setAccessible(true);

$this->assertSame($expected, $ref->invoke($package, $version));
Assert::same($ref->invoke($package, $version), $expected);
}

/**
* @dataProvider getMinVersionDataProvider
*/
#[DataProvider('getMinVersionDataProvider')]
public function testGetMinVersion(string $version, string $expected): void
{
$package = new Package();
$ref = new \ReflectionMethod($package, 'getMinVersion');
$ref->setAccessible(true);

$this->assertSame($expected, $ref->invoke($package, $version));
Assert::same($ref->invoke($package, $version), $expected);
}

public static function isSupportedVersionDataProvider(): \Traversable
Expand Down
13 changes: 7 additions & 6 deletions tests/src/Unit/Environment/NativeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

namespace RoadRunner\VersionChecker\Tests\Unit\Environment;

use PHPUnit\Framework\TestCase;
use RoadRunner\VersionChecker\Environment\Native;
use Testo\Assert;
use Testo\Data\DataProvider;
use Testo\Test;

final class NativeTest extends TestCase
#[Test]
final class NativeTest
{
/**
* @dataProvider valuesDataProvider
*/
#[DataProvider('valuesDataProvider')]
public function testGet(mixed $value, mixed $expected, string $key): void
{
$native = new Native([
Expand All @@ -20,7 +21,7 @@ public function testGet(mixed $value, mixed $expected, string $key): void
'3' => true,
]);

$this->assertSame($expected, $native->get($key));
Assert::same($native->get($key), $expected);
}


Expand Down
31 changes: 13 additions & 18 deletions tests/src/Unit/Version/ComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,36 @@

namespace RoadRunner\VersionChecker\Tests\Unit\Version;

use PHPUnit\Framework\TestCase;
use RoadRunner\VersionChecker\Version\Comparator;
use Testo\Assert;
use Testo\Data\DataProvider;
use Testo\Test;

final class ComparatorTest extends TestCase
#[Test]
final class ComparatorTest
{
/**
* @dataProvider greaterThanDataProvider
*/
#[DataProvider('greaterThanDataProvider')]
public function testGreaterThan(string $requested, string $installed, bool $expected): void
{
$comparator = new Comparator();

$this->assertSame($expected, $comparator->greaterThan($requested, $installed));
Assert::same($comparator->greaterThan($requested, $installed), $expected);
}

/**
* @dataProvider lessThanDataProvider
*/
#[DataProvider('lessThanDataProvider')]
public function testLessThan(string $requested, string $installed, bool $expected): void
{
$comparator = new Comparator();

$this->assertSame($expected, $comparator->lessThan($requested, $installed));
Assert::same($comparator->lessThan($requested, $installed), $expected);
}

/**
* @dataProvider equalDataProvider
*/
#[DataProvider('equalDataProvider')]
public function testEqual(string $requested, string $installed, bool $expected): void
{
$comparator = new Comparator();

$this->assertSame($expected, $comparator->equal($requested, $installed));
Assert::same($comparator->equal($requested, $installed), $expected);
}

public static function greaterThanDataProvider(): \Traversable
Expand Down Expand Up @@ -116,12 +113,10 @@ public static function equalDataProvider(): \Traversable
yield ['2025.1.0', '3.0.0', false];
}

/**
* @dataProvider compareDataProvider
*/
#[DataProvider('compareDataProvider')]
public function testCompare(string $a, string $b, int $expected): void
{
$this->assertSame($expected, Comparator::compare($a, $b));
Assert::same(Comparator::compare($a, $b), $expected);
}

public static function compareDataProvider(): \Traversable
Expand Down
Loading
Loading