Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from TheDragonCode/main
Actualize branch
- Loading branch information
Showing
10 changed files
with
255 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: phpunit | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
name: PHP Unit | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
run: composer update --prefer-stable --prefer-dist --no-progress --no-interaction | ||
|
||
- name: Execute tests | ||
run: sudo vendor/bin/phpunit --colors=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
verbose="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Tests\Fixtures\Support; | ||
|
||
use DragonCode\CodeStyler\Support\PhpVersion as BasePhpVersion; | ||
|
||
class PhpVersion extends BasePhpVersion | ||
{ | ||
protected array $composer = []; | ||
|
||
public function setComposer(array $values): self | ||
{ | ||
$this->composer = $values; | ||
|
||
return $this; | ||
} | ||
|
||
protected function composer(): ?array | ||
{ | ||
return $this->composer; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<?php | ||
|
||
namespace Tests\Support; | ||
|
||
use Tests\Fixtures\Support\PhpVersion; | ||
use Tests\TestCase; | ||
|
||
class PhpVersionTest extends TestCase | ||
{ | ||
public function test72() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require' => [ | ||
'php' => '^8.0 || ^7.1', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('7.2', $helper); | ||
} | ||
|
||
public function test72Dev() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require-dev' => [ | ||
'php' => '^8.0 || ^7.1', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('7.2', $helper); | ||
} | ||
|
||
public function test74() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require' => [ | ||
'php' => '^8.0 || ^7.4', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('7.4', $helper); | ||
} | ||
|
||
public function test74Dev() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require-dev' => [ | ||
'php' => '^8.0 || ^7.4', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('7.4', $helper); | ||
} | ||
|
||
public function test80() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require' => [ | ||
'php' => '^8.0', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('8.0', $helper); | ||
} | ||
|
||
public function test80Dev() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require-dev' => [ | ||
'php' => '^8.0', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('8.0', $helper); | ||
} | ||
|
||
public function test81() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require' => [ | ||
'php' => '^8.1', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('8.1', $helper); | ||
} | ||
|
||
public function test81Dev() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require-dev' => [ | ||
'php' => '^8.1', | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('8.1', $helper); | ||
} | ||
|
||
public function testDefault() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require' => [ | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('8.1', $helper); | ||
} | ||
|
||
public function testDefaultDev() | ||
{ | ||
$helper = PhpVersion::make()->setComposer([ | ||
'require-dev' => [ | ||
'ext-json' => '*', | ||
'foo/bar' => '^1.0', | ||
], | ||
])->get(); | ||
|
||
$this->assertSame('8.1', $helper); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Tests; | ||
|
||
use PHPUnit\Framework\TestCase as BaseTestCase; | ||
|
||
abstract class TestCase extends BaseTestCase | ||
{ | ||
} |