This commit is contained in:
parent
6ff9476c0b
commit
a2cb95aa5b
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,3 +30,4 @@ build/humbuglog.txt
|
|||||||
phpdoc/
|
phpdoc/
|
||||||
tests/test_data/json_write.json
|
tests/test_data/json_write.json
|
||||||
tests/test_data/sessions/
|
tests/test_data/sessions/
|
||||||
|
.phpunit.result.cache
|
@ -6,6 +6,8 @@ install:
|
|||||||
php:
|
php:
|
||||||
- 7.1
|
- 7.1
|
||||||
- 7.2
|
- 7.2
|
||||||
|
- 7.3
|
||||||
|
- 7.4
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
34
Jenkinsfile
vendored
34
Jenkinsfile
vendored
@ -9,8 +9,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'chmod +x ./build/docker_install.sh'
|
|
||||||
sh 'sh build/docker_install.sh'
|
|
||||||
sh 'apk add --no-cache php7-phpdbg'
|
sh 'apk add --no-cache php7-phpdbg'
|
||||||
sh 'curl -sS https://getcomposer.org/installer | php'
|
sh 'curl -sS https://getcomposer.org/installer | php'
|
||||||
sh 'php composer.phar install --ignore-platform-reqs'
|
sh 'php composer.phar install --ignore-platform-reqs'
|
||||||
@ -25,8 +23,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'chmod +x ./build/docker_install.sh'
|
|
||||||
sh 'sh build/docker_install.sh'
|
|
||||||
sh 'apk add --no-cache php7-phpdbg'
|
sh 'apk add --no-cache php7-phpdbg'
|
||||||
sh 'curl -sS https://getcomposer.org/installer | php'
|
sh 'curl -sS https://getcomposer.org/installer | php'
|
||||||
sh 'php composer.phar install --ignore-platform-reqs'
|
sh 'php composer.phar install --ignore-platform-reqs'
|
||||||
@ -41,8 +37,34 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'chmod +x ./build/docker_install.sh'
|
sh 'apk add --no-cache php7-phpdbg'
|
||||||
sh 'sh build/docker_install.sh'
|
sh 'curl -sS https://getcomposer.org/installer | php'
|
||||||
|
sh 'php composer.phar install --ignore-platform-reqs'
|
||||||
|
sh 'php composer.phar run-script coverage -- --coverage-text --colors=never'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('PHP 7.3') {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'php:7.3-alpine'
|
||||||
|
args '-u root --privileged'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'apk add --no-cache php7-phpdbg'
|
||||||
|
sh 'curl -sS https://getcomposer.org/installer | php'
|
||||||
|
sh 'php composer.phar install --ignore-platform-reqs'
|
||||||
|
sh 'php composer.phar run-script coverage -- --coverage-text --colors=never'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('PHP 7.4') {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'php:7.4-alpine'
|
||||||
|
args '-u root --privileged'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
sh 'apk add --no-cache php7-phpdbg'
|
sh 'apk add --no-cache php7-phpdbg'
|
||||||
sh 'curl -sS https://getcomposer.org/installer | php'
|
sh 'curl -sS https://getcomposer.org/installer | php'
|
||||||
sh 'php composer.phar install --ignore-platform-reqs'
|
sh 'php composer.phar install --ignore-platform-reqs'
|
||||||
|
@ -93,12 +93,12 @@ class InlineCommentSniff implements Sniff
|
|||||||
private function _checkCommentStyle(File $phpcsFile, $stackPtr)
|
private function _checkCommentStyle(File $phpcsFile, $stackPtr)
|
||||||
{
|
{
|
||||||
$tokens = $phpcsFile->getTokens();
|
$tokens = $phpcsFile->getTokens();
|
||||||
if ($tokens[$stackPtr]['content']{0} === '#') {
|
if ($tokens[$stackPtr]['content'][0] === '#') {
|
||||||
$error = 'Perl-style comments are not allowed; use "// Comment" or DocBlock comments instead';
|
$error = 'Perl-style comments are not allowed; use "// Comment" or DocBlock comments instead';
|
||||||
$phpcsFile->addError($error, $stackPtr, 'WrongStyle');
|
$phpcsFile->addError($error, $stackPtr, 'WrongStyle');
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (substr($tokens[$stackPtr]['content'], 0, 2) === '/*'
|
} else if (substr($tokens[$stackPtr]['content'], 0, 2) === '/*'
|
||||||
|| $tokens[$stackPtr]['content']{0} === '*'
|
|| $tokens[$stackPtr]['content'][0] === '*'
|
||||||
) {
|
) {
|
||||||
$error = 'Multi lines comments are not allowed; use "// Comment" DocBlock comments instead';
|
$error = 'Multi lines comments are not allowed; use "// Comment" DocBlock comments instead';
|
||||||
$phpcsFile->addError($error, $stackPtr, 'WrongStyle');
|
$phpcsFile->addError($error, $stackPtr, 'WrongStyle');
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# We need to install dependencies only for Docker
|
|
||||||
[[ ! -e /.dockerenv ]] && [[ ! -e /.dockerinit ]] && exit 0
|
|
||||||
|
|
||||||
set -xe
|
|
||||||
|
|
||||||
# Install git (the php image doesn't have it) which is required by composer
|
|
||||||
apk --update add --no-cache \
|
|
||||||
curl \
|
|
||||||
git
|
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* @package Ion
|
* @package Ion
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2018 Timothy J. Warren
|
* @copyright 2015 - 2019 Timothy J. Warren
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
* @version 2.4.1
|
* @version 2.4.1
|
||||||
* @link https://git.timshomepage.net/timw4mail/ion
|
* @link https://git.timshomepage.net/timw4mail/ion
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"aviat/query": "^2.5",
|
"aviat/query": "^2.5",
|
||||||
"aura/html": "2.*",
|
"aura/html": "2.*",
|
||||||
"container-interop/container-interop": "1.*",
|
|
||||||
"danielstjules/stringy": "^3.0.0",
|
"danielstjules/stringy": "^3.0.0",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"psr/http-message": "~1.0",
|
"psr/http-message": "~1.0",
|
||||||
@ -29,17 +28,18 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"aura/session": "^2.1.0",
|
"aura/session": "^2.1.0",
|
||||||
"consolidation/robo": "^1.1.0",
|
"consolidation/robo": "^2.0.0",
|
||||||
"monolog/monolog": "1.*",
|
"monolog/monolog": "^2.0.1",
|
||||||
"pdepend/pdepend": "^2.2",
|
"pdepend/pdepend": "^2.2",
|
||||||
"phploc/phploc": "^4.0",
|
"phploc/phploc": "^5.0",
|
||||||
"phpmd/phpmd": "^2.4",
|
"phpmd/phpmd": "^2.4",
|
||||||
"phpstan/phpstan": "^0.9.1",
|
"phpstan/phpstan": "^0.12.0",
|
||||||
"phpunit/phpunit": "^6.5.13",
|
"phpunit/phpunit": "^8.4.3",
|
||||||
|
"roave/security-advisories": "dev-master",
|
||||||
"robmorgan/phinx": "^0.10.6",
|
"robmorgan/phinx": "^0.10.6",
|
||||||
"sebastian/phpcpd": "^3.0.1",
|
"sebastian/phpcpd": "^4.1.0",
|
||||||
"squizlabs/php_codesniffer": "^3.0.0",
|
"squizlabs/php_codesniffer": "^3.0.0",
|
||||||
"theseer/phpdox": "^0.11.0"
|
"theseer/phpdox": "^0.12.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
|
"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
|
||||||
|
@ -20,8 +20,7 @@ use Aviat\Ion\Config;
|
|||||||
|
|
||||||
class ConfigTest extends Ion_TestCase {
|
class ConfigTest extends Ion_TestCase {
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
$this->config = new Config([
|
$this->config = new Config([
|
||||||
'foo' => 'bar',
|
'foo' => 'bar',
|
||||||
'asset_path' => '/assets',
|
'asset_path' => '/assets',
|
||||||
|
@ -33,8 +33,7 @@ class ContainerAwareTest extends Ion_TestCase {
|
|||||||
|
|
||||||
protected $aware;
|
protected $aware;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
$this->container = new Container();
|
$this->container = new Container();
|
||||||
$this->aware = new Aware($this->container);
|
$this->aware = new Aware($this->container);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ use Aviat\Ion\Di\Exception\ContainerException;
|
|||||||
use Aviat\Ion\Tests\Ion_TestCase;
|
use Aviat\Ion\Tests\Ion_TestCase;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Monolog\Handler\{TestHandler, NullHandler};
|
use Monolog\Handler\{TestHandler, NullHandler};
|
||||||
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
use Aviat\Ion\Di\Exception\NotFoundException;
|
||||||
|
|
||||||
class FooTest {
|
class FooTest {
|
||||||
|
|
||||||
@ -37,27 +39,27 @@ class FooTest2 {
|
|||||||
|
|
||||||
class ContainerTest extends Ion_TestCase {
|
class ContainerTest extends Ion_TestCase {
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$this->container = new Container();
|
$this->container = new Container();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataGetWithException()
|
public function dataGetWithException(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Bad index type: number' => [
|
'Bad index type: number' => [
|
||||||
'id' => 42,
|
'id' => 42,
|
||||||
'exception' => 'Aviat\Ion\Di\Exception\ContainerException',
|
'exception' => ContainerException::class,
|
||||||
'message' => 'Id must be a string'
|
'message' => 'Id must be a string'
|
||||||
],
|
],
|
||||||
'Bad index type: array' => [
|
'Bad index type: array' => [
|
||||||
'id' => [],
|
'id' => [],
|
||||||
'exception' => 'Aviat\Ion\Di\Exception\ContainerException',
|
'exception' => ContainerException::class,
|
||||||
'message' => 'Id must be a string'
|
'message' => 'Id must be a string'
|
||||||
],
|
],
|
||||||
'Non-existent id' => [
|
'Non-existent id' => [
|
||||||
'id' => 'foo',
|
'id' => 'foo',
|
||||||
'exception' => 'Aviat\Ion\Di\Exception\NotFoundException',
|
'exception' => NotFoundException::class,
|
||||||
'message' => "Item 'foo' does not exist in container."
|
'message' => "Item 'foo' does not exist in container."
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@ -66,7 +68,7 @@ class ContainerTest extends Ion_TestCase {
|
|||||||
/**
|
/**
|
||||||
* @dataProvider dataGetWithException
|
* @dataProvider dataGetWithException
|
||||||
*/
|
*/
|
||||||
public function testGetWithException($id, $exception, $message)
|
public function testGetWithException($id, $exception, $message): void
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -82,24 +84,24 @@ class ContainerTest extends Ion_TestCase {
|
|||||||
/**
|
/**
|
||||||
* @dataProvider dataGetWithException
|
* @dataProvider dataGetWithException
|
||||||
*/
|
*/
|
||||||
public function testGetNewWithException($id, $exception, $message)
|
public function testGetNewWithException($id, $exception, $message): void
|
||||||
{
|
{
|
||||||
$this->expectException($exception);
|
$this->expectException($exception);
|
||||||
$this->expectExceptionMessage($message);
|
$this->expectExceptionMessage($message);
|
||||||
$this->container->getNew($id);
|
$this->container->getNew($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataSetInstanceWithException()
|
public function dataSetInstanceWithException(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Non-existent id' => [
|
'Non-existent id' => [
|
||||||
'id' => 'foo',
|
'id' => 'foo',
|
||||||
'exception' => 'Aviat\Ion\Di\Exception\NotFoundException',
|
'exception' => NotFoundException::class,
|
||||||
'message' => "Factory 'foo' does not exist in container. Set that first.",
|
'message' => "Factory 'foo' does not exist in container. Set that first.",
|
||||||
],
|
],
|
||||||
'Non-existent id 2' => [
|
'Non-existent id 2' => [
|
||||||
'id' => 'foobarbaz',
|
'id' => 'foobarbaz',
|
||||||
'exception' => 'Aviat\Ion\Di\Exception\NotFoundException',
|
'exception' => NotFoundException::class,
|
||||||
'message' => "Factory 'foobarbaz' does not exist in container. Set that first.",
|
'message' => "Factory 'foobarbaz' does not exist in container. Set that first.",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@ -108,7 +110,7 @@ class ContainerTest extends Ion_TestCase {
|
|||||||
/**
|
/**
|
||||||
* @dataProvider dataSetInstanceWithException
|
* @dataProvider dataSetInstanceWithException
|
||||||
*/
|
*/
|
||||||
public function testSetInstanceWithException($id, $exception, $message)
|
public function testSetInstanceWithException($id, $exception, $message): void
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -121,21 +123,21 @@ class ContainerTest extends Ion_TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNew()
|
public function testGetNew(): void
|
||||||
{
|
{
|
||||||
$this->container->set('footest', function($item) {
|
$this->container->set('footest', static function($item) {
|
||||||
return new FooTest($item);
|
return new FooTest($item);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check that the item is the container, if called without arguments
|
// Check that the item is the container, if called without arguments
|
||||||
$footest1 = $this->container->getNew('footest');
|
$footest1 = $this->container->getNew('footest');
|
||||||
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $footest1->item);
|
$this->assertInstanceOf(ContainerInterface::class, $footest1->item);
|
||||||
|
|
||||||
$footest2 = $this->container->getNew('footest', ['Test String']);
|
$footest2 = $this->container->getNew('footest', ['Test String']);
|
||||||
$this->assertEquals('Test String', $footest2->item);
|
$this->assertEquals('Test String', $footest2->item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetContainerInInstance()
|
public function testSetContainerInInstance(): void
|
||||||
{
|
{
|
||||||
$this->container->set('footest2', function() {
|
$this->container->set('footest2', function() {
|
||||||
return new FooTest2();
|
return new FooTest2();
|
||||||
@ -145,36 +147,36 @@ class ContainerTest extends Ion_TestCase {
|
|||||||
$this->assertEquals($this->container, $footest2->getContainer());
|
$this->assertEquals($this->container, $footest2->getContainer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNewReturnCallable()
|
public function testGetNewReturnCallable(): void
|
||||||
{
|
{
|
||||||
$this->container->set('footest', function($item) {
|
$this->container->set('footest', static function($item) {
|
||||||
return function() use ($item) {
|
return static function() use ($item) {
|
||||||
return $item;
|
return $item;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check that the item is the container, if called without arguments
|
// Check that the item is the container, if called without arguments
|
||||||
$footest1 = $this->container->getNew('footest');
|
$footest1 = $this->container->getNew('footest');
|
||||||
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $footest1());
|
$this->assertInstanceOf(ContainerInterface::class, $footest1());
|
||||||
|
|
||||||
$footest2 = $this->container->getNew('footest', ['Test String']);
|
$footest2 = $this->container->getNew('footest', ['Test String']);
|
||||||
$this->assertEquals('Test String', $footest2());
|
$this->assertEquals('Test String', $footest2());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSet()
|
public function testGetSet(): void
|
||||||
{
|
{
|
||||||
$container = $this->container->set('foo', function() {
|
$container = $this->container->set('foo', static function() {
|
||||||
return function() {};
|
return static function() {};
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->assertInstanceOf(Container::class, $container);
|
$this->assertInstanceOf(Container::class, $container);
|
||||||
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $container);
|
$this->assertInstanceOf(ContainerInterface::class, $container);
|
||||||
|
|
||||||
// The factory returns a callable
|
// The factory returns a callable
|
||||||
$this->assertTrue(is_callable($container->get('foo')));
|
$this->assertTrue(is_callable($container->get('foo')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoggerMethods()
|
public function testLoggerMethods(): void
|
||||||
{
|
{
|
||||||
// Does the container have the default logger?
|
// Does the container have the default logger?
|
||||||
$this->assertFalse($this->container->hasLogger());
|
$this->assertFalse($this->container->hasLogger());
|
||||||
@ -189,8 +191,8 @@ class ContainerTest extends Ion_TestCase {
|
|||||||
$container = $this->container->setLogger($logger1);
|
$container = $this->container->setLogger($logger1);
|
||||||
$container2 = $this->container->setLogger($logger2, 'test');
|
$container2 = $this->container->setLogger($logger2, 'test');
|
||||||
|
|
||||||
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $container);
|
$this->assertInstanceOf(ContainerInterface::class, $container);
|
||||||
$this->assertInstanceOf('Aviat\Ion\Di\Container', $container2);
|
$this->assertInstanceOf(Container::class, $container2);
|
||||||
|
|
||||||
$this->assertEquals($logger1, $this->container->getLogger('default'));
|
$this->assertEquals($logger1, $this->container->getLogger('default'));
|
||||||
$this->assertEquals($logger2, $this->container->getLogger('test'));
|
$this->assertEquals($logger2, $this->container->getLogger('test'));
|
||||||
|
@ -26,8 +26,7 @@ class EnumTest extends Ion_TestCase {
|
|||||||
'FOOBAR' => 'baz'
|
'FOOBAR' => 'baz'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->enum = new TestEnum();
|
$this->enum = new TestEnum();
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ use Aviat\Ion\Tests\FriendTestClass;
|
|||||||
|
|
||||||
class FriendTest extends Ion_TestCase {
|
class FriendTest extends Ion_TestCase {
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$obj = new FriendTestClass();
|
$obj = new FriendTestClass();
|
||||||
$this->friend = new Friend($obj);
|
$this->friend = new Friend($obj);
|
||||||
|
@ -18,11 +18,8 @@ namespace Aviat\Ion\Tests;
|
|||||||
|
|
||||||
use function Aviat\Ion\_dir;
|
use function Aviat\Ion\_dir;
|
||||||
|
|
||||||
use Aura\Web\WebFactory;
|
|
||||||
use Aviat\Ion\Json;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\Diactoros\Response as HttpResponse;
|
|
||||||
|
|
||||||
define('ROOT_DIR', realpath(__DIR__ . '/../') . '/');
|
define('ROOT_DIR', realpath(__DIR__ . '/../') . '/');
|
||||||
define('SRC_DIR', ROOT_DIR . 'src/');
|
define('SRC_DIR', ROOT_DIR . 'src/');
|
||||||
@ -34,10 +31,10 @@ define('TEST_VIEW_DIR', __DIR__ . '/test_views');
|
|||||||
*/
|
*/
|
||||||
class Ion_TestCase extends TestCase {
|
class Ion_TestCase extends TestCase {
|
||||||
// Test directory constants
|
// Test directory constants
|
||||||
const ROOT_DIR = ROOT_DIR;
|
public const ROOT_DIR = ROOT_DIR;
|
||||||
const SRC_DIR = SRC_DIR;
|
public const SRC_DIR = SRC_DIR;
|
||||||
const TEST_DATA_DIR = TEST_DATA_DIR;
|
public const TEST_DATA_DIR = TEST_DATA_DIR;
|
||||||
const TEST_VIEW_DIR = TEST_VIEW_DIR;
|
public const TEST_VIEW_DIR = TEST_VIEW_DIR;
|
||||||
|
|
||||||
protected $container;
|
protected $container;
|
||||||
protected static $staticContainer;
|
protected static $staticContainer;
|
||||||
@ -51,7 +48,7 @@ class Ion_TestCase extends TestCase {
|
|||||||
self::$session_handler = $session_handler;
|
self::$session_handler = $session_handler;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -100,7 +97,7 @@ class Ion_TestCase extends TestCase {
|
|||||||
// Set up DI container
|
// Set up DI container
|
||||||
$di = require('di.php');
|
$di = require('di.php');
|
||||||
$container = $di($config_array);
|
$container = $di($config_array);
|
||||||
$container->set('session-handler', function() {
|
$container->set('session-handler', static function() {
|
||||||
// Use mock session handler
|
// Use mock session handler
|
||||||
$session_handler = new TestSessionHandler();
|
$session_handler = new TestSessionHandler();
|
||||||
session_set_save_handler($session_handler, TRUE);
|
session_set_save_handler($session_handler, TRUE);
|
||||||
@ -116,7 +113,7 @@ class Ion_TestCase extends TestCase {
|
|||||||
* @param array $supers
|
* @param array $supers
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setSuperGlobals(array $supers = [])
|
public function setSuperGlobals(array $supers = []): void
|
||||||
{
|
{
|
||||||
$default = [
|
$default = [
|
||||||
'_SERVER' => $_SERVER,
|
'_SERVER' => $_SERVER,
|
||||||
@ -127,7 +124,7 @@ class Ion_TestCase extends TestCase {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$request = call_user_func_array(
|
$request = call_user_func_array(
|
||||||
['Zend\Diactoros\ServerRequestFactory', 'fromGlobals'],
|
[ServerRequestFactory::class, 'fromGlobals'],
|
||||||
array_merge($default, $supers)
|
array_merge($default, $supers)
|
||||||
);
|
);
|
||||||
$this->container->setInstance('request', $request);
|
$this->container->setInstance('request', $request);
|
||||||
|
@ -24,8 +24,7 @@ class StringWrapperTest extends TestCase {
|
|||||||
|
|
||||||
protected $wrapper;
|
protected $wrapper;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
$this->wrapper = new class {
|
$this->wrapper = new class {
|
||||||
use StringWrapper;
|
use StringWrapper;
|
||||||
};
|
};
|
||||||
|
@ -25,8 +25,7 @@ class AbstractTransformerTest extends Ion_TestCase {
|
|||||||
protected $untransformer;
|
protected $untransformer;
|
||||||
|
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
$this->transformer = new TestTransformer();
|
$this->transformer = new TestTransformer();
|
||||||
$this->untransformer = new TestTransformerUntransform();
|
$this->untransformer = new TestTransformerUntransform();
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@ use Aviat\Ion\Tests\Ion_TestCase;
|
|||||||
class ArrayTypeTest extends Ion_TestCase {
|
class ArrayTypeTest extends Ion_TestCase {
|
||||||
use ArrayWrapper;
|
use ArrayWrapper;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,7 @@ class HtmlViewTest extends HttpViewTest {
|
|||||||
|
|
||||||
protected $template_path;
|
protected $template_path;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->view = new TestHtmlView($this->container);
|
$this->view = new TestHtmlView($this->container);
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,7 @@ class HttpViewTest extends Ion_TestCase {
|
|||||||
protected $view;
|
protected $view;
|
||||||
protected $friend;
|
protected $friend;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->view = new TestHttpView($this->container);
|
$this->view = new TestHttpView($this->container);
|
||||||
$this->friend = new Friend($this->view);
|
$this->friend = new Friend($this->view);
|
||||||
|
@ -21,8 +21,7 @@ use Aviat\Ion\Tests\TestJsonView;
|
|||||||
|
|
||||||
class JsonViewTest extends HttpViewTest {
|
class JsonViewTest extends HttpViewTest {
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->view = new TestJsonView($this->container);
|
$this->view = new TestJsonView($this->container);
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Ion
|
* Hummingbird Anime List Client
|
||||||
*
|
*
|
||||||
* Building blocks for web development
|
* An API client for Kitsu to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 7.1
|
* PHP version 7.1
|
||||||
*
|
*
|
||||||
* @package Ion
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2018 Timothy J. Warren
|
* @copyright 2015 - 2018 Timothy J. Warren
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
* @version 2.4.1
|
* @version 4.1
|
||||||
* @link https://git.timshomepage.net/timw4mail/ion
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\Ion\Tests;
|
namespace Aviat\Ion\Tests;
|
||||||
@ -26,8 +26,7 @@ class XMLTest extends TestCase {
|
|||||||
protected $object;
|
protected $object;
|
||||||
protected $array;
|
protected $array;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void {
|
||||||
{
|
|
||||||
$this->xml = file_get_contents(__DIR__ . '/test_data/XML/xmlTestFile.xml');
|
$this->xml = file_get_contents(__DIR__ . '/test_data/XML/xmlTestFile.xml');
|
||||||
$this->expectedXml = file_get_contents(__DIR__ . '/test_data/XML/minifiedXmlTestFile.xml');
|
$this->expectedXml = file_get_contents(__DIR__ . '/test_data/XML/minifiedXmlTestFile.xml');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user