-
-
Notifications
You must be signed in to change notification settings - Fork 133
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 #406 from tedious/test_upgrades
Use Github Actions instead of Travis CI for testing
- Loading branch information
Showing
24 changed files
with
149 additions
and
942 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: CI | ||
|
||
on: [push] | ||
env: | ||
IS_GITHUB: "true" | ||
|
||
jobs: | ||
phpunit: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php_version: ["8.0", "8.1", "latest"] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Start Redis on Default Port | ||
uses: supercharge/[email protected] | ||
with: | ||
redis-port: 6379 | ||
|
||
|
||
# - name: Start 2nd Redis Server on 6380 | ||
# uses: supercharge/[email protected] | ||
# with: | ||
# redis-port: 6380 | ||
|
||
# These are the versions of the *actions*, not the libraries. | ||
- name: Install PHP Packages | ||
uses: php-actions/composer@v5 | ||
|
||
- name: Run Tests | ||
uses: php-actions/phpunit@v3 | ||
with: | ||
php_version: ${{ matrix.php_version }} |
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
/build | ||
|
||
.php_cs.cache | ||
.phpunit.result.cache |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit bootstrap="./tests/bootstrap.php" colors="true"> | ||
<testsuites> | ||
<testsuite name="Stash Test Suite"> | ||
<directory suffix="Test.php">./tests/Stash/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./src/Stash/</directory> | ||
<exclude> | ||
<directory>./src/Stash/Exception</directory> | ||
<directory>./src/Stash/Interfaces</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">./src/Stash/</directory> | ||
</include> | ||
<exclude> | ||
<directory>./src/Stash/Exception</directory> | ||
<directory>./src/Stash/Interfaces</directory> | ||
</exclude> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Stash Test Suite"> | ||
<directory suffix="Test.php">./tests/Stash/</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
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
* @package Stash | ||
* @author Robert Hafner <[email protected]> | ||
*/ | ||
class AbstractPoolTest extends \PHPUnit\Framework\TestCase | ||
class AbstractPoolTest extends AbstractTest | ||
{ | ||
protected $data = array(array('test', 'test')); | ||
protected $multiData = array('key' => 'value', | ||
|
@@ -172,11 +172,11 @@ public function testCommit() | |
|
||
|
||
/** | ||
* @expectedException InvalidArgumentException | ||
* @expectedExceptionMessage Invalid or Empty Node passed to getItem constructor. | ||
*/ | ||
public function testGetItemInvalidKeyMissingNode() | ||
{ | ||
$this->expectException('InvalidArgumentException'); | ||
$pool = $this->getTestPool(); | ||
$item = $pool->getItem('This/Test//Fail'); | ||
} | ||
|
@@ -277,11 +277,11 @@ public function testNamespacing() | |
} | ||
|
||
/** | ||
* @expectedException InvalidArgumentException | ||
* @expectedExceptionMessage Namespace must be alphanumeric. | ||
*/ | ||
public function testInvalidNamespace() | ||
{ | ||
$this->expectException('InvalidArgumentException'); | ||
$pool = $this->getTestPool(); | ||
$pool->setNamespace('!@#$%^&*('); | ||
} | ||
|
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,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Stash package. | ||
* | ||
* (c) Robert Hafner <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Stash\Test; | ||
|
||
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; | ||
|
||
/** | ||
* @package Stash | ||
* @author Robert Hafner <[email protected]> | ||
*/ | ||
abstract class AbstractTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
use ArraySubsetAsserts; | ||
|
||
public function accessProtected($obj, $prop) { | ||
$reflection = new \ReflectionClass($obj); | ||
$property = $reflection->getProperty($prop); | ||
$property->setAccessible(true); | ||
return $property->getValue($obj); | ||
} | ||
|
||
public function assertAttributeEquals($expectedValue, $actualAttributeName, $object, $errorMessage="") { | ||
$actualValue = $this->accessProtected($object, $actualAttributeName); | ||
return $this->assertSame($expectedValue, $actualValue, $errorMessage); | ||
} | ||
|
||
public function assertAttributeInstanceOf($expectedClass, $actualAttributeName, $object, $errorMessage="") { | ||
$actualValue = $this->accessProtected($object, $actualAttributeName); | ||
return $this->assertInstanceOf($expectedClass, $actualValue); | ||
} | ||
|
||
public function assertAttributeInternalType($expectedType, $actualAttributeName, $object, $errorMessage="") { | ||
$actualValue = $this->accessProtected($object, $actualAttributeName); | ||
return $this->assertSame($expectedType, gettype($actualValue), $errorMessage); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* @package Stash | ||
* @author Robert Hafner <[email protected]> | ||
*/ | ||
abstract class AbstractDriverTest extends \PHPUnit\Framework\TestCase | ||
abstract class AbstractDriverTest extends \Stash\Test\AbstractTest | ||
{ | ||
protected $data = array('string' => 'Hello world!', | ||
'complexString' => "\t\tHello\r\n\r\'\'World!\"\'\\", | ||
|
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
Oops, something went wrong.