Update dependencies
Gitea - aviat/ion/master This commit looks good Details

This commit is contained in:
Timothy Warren 2019-12-05 15:25:47 -05:00
parent 6ff9476c0b
commit a2cb95aa5b
20 changed files with 138 additions and 136 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@ build/humbuglog.txt
phpdoc/
tests/test_data/json_write.json
tests/test_data/sessions/
.phpunit.result.cache

View File

@ -6,6 +6,8 @@ install:
php:
- 7.1
- 7.2
- 7.3
- 7.4
- nightly
script:

34
Jenkinsfile vendored
View File

@ -9,8 +9,6 @@ pipeline {
}
}
steps {
sh 'chmod +x ./build/docker_install.sh'
sh 'sh build/docker_install.sh'
sh 'apk add --no-cache php7-phpdbg'
sh 'curl -sS https://getcomposer.org/installer | php'
sh 'php composer.phar install --ignore-platform-reqs'
@ -25,8 +23,6 @@ pipeline {
}
}
steps {
sh 'chmod +x ./build/docker_install.sh'
sh 'sh build/docker_install.sh'
sh 'apk add --no-cache php7-phpdbg'
sh 'curl -sS https://getcomposer.org/installer | php'
sh 'php composer.phar install --ignore-platform-reqs'
@ -41,8 +37,34 @@ pipeline {
}
}
steps {
sh 'chmod +x ./build/docker_install.sh'
sh 'sh build/docker_install.sh'
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.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 'curl -sS https://getcomposer.org/installer | php'
sh 'php composer.phar install --ignore-platform-reqs'

View File

@ -93,12 +93,12 @@ class InlineCommentSniff implements Sniff
private function _checkCommentStyle(File $phpcsFile, $stackPtr)
{
$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';
$phpcsFile->addError($error, $stackPtr, 'WrongStyle');
return FALSE;
} 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';
$phpcsFile->addError($error, $stackPtr, 'WrongStyle');

View File

@ -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

View File

@ -7,7 +7,7 @@
*
* @package Ion
* @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
* @version 2.4.1
* @link https://git.timshomepage.net/timw4mail/ion

View File

@ -1,54 +1,54 @@
{
"name": "aviat/ion",
"description": "Basic PHP Framework",
"license":"MIT",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Aviat\\Ion\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Aviat\\Ion\\Tests\\": "tests/",
"CodeIgniter\\": "build/CodeIgniter/"
}
},
"require": {
"aviat/query": "^2.5",
"aura/html": "2.*",
"container-interop/container-interop": "1.*",
"danielstjules/stringy": "^3.0.0",
"ext-json": "*",
"psr/http-message": "~1.0",
"psr/log": "~1.0",
"zendframework/zend-diactoros": "^2.0.0",
"zendframework/zend-httphandlerrunner": "^1.0"
},
"require-dev": {
"aura/session": "^2.1.0",
"consolidation/robo": "^1.1.0",
"monolog/monolog": "1.*",
"pdepend/pdepend": "^2.2",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "^2.4",
"phpstan/phpstan": "^0.9.1",
"phpunit/phpunit": "^6.5.13",
"robmorgan/phinx": "^0.10.6",
"sebastian/phpcpd": "^3.0.1",
"squizlabs/php_codesniffer": "^3.0.0",
"theseer/phpdox": "^0.11.0"
},
"scripts": {
"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
"build": "robo build",
"docs": "cd build && ../vendor/bin/phpdox && cd ..",
"phpstan": "phpstan analyse -l 7 -c phpstan.neon src tests",
"test": "phpunit -c phpunit.dist.xml"
},
"suggest": {
"monolog/monolog": "Provides implementation of psr/log"
"name": "aviat/ion",
"description": "Basic PHP Framework",
"license": "MIT",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Aviat\\Ion\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Aviat\\Ion\\Tests\\": "tests/",
"CodeIgniter\\": "build/CodeIgniter/"
}
},
"require": {
"aviat/query": "^2.5",
"aura/html": "2.*",
"danielstjules/stringy": "^3.0.0",
"ext-json": "*",
"psr/http-message": "~1.0",
"psr/log": "~1.0",
"zendframework/zend-diactoros": "^2.0.0",
"zendframework/zend-httphandlerrunner": "^1.0"
},
"require-dev": {
"aura/session": "^2.1.0",
"consolidation/robo": "^2.0.0",
"monolog/monolog": "^2.0.1",
"pdepend/pdepend": "^2.2",
"phploc/phploc": "^5.0",
"phpmd/phpmd": "^2.4",
"phpstan/phpstan": "^0.12.0",
"phpunit/phpunit": "^8.4.3",
"roave/security-advisories": "dev-master",
"robmorgan/phinx": "^0.10.6",
"sebastian/phpcpd": "^4.1.0",
"squizlabs/php_codesniffer": "^3.0.0",
"theseer/phpdox": "^0.12.0"
},
"scripts": {
"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
"build": "robo build",
"docs": "cd build && ../vendor/bin/phpdox && cd ..",
"phpstan": "phpstan analyse -l 7 -c phpstan.neon src tests",
"test": "phpunit -c phpunit.dist.xml"
},
"suggest": {
"monolog/monolog": "Provides implementation of psr/log"
}
}

View File

@ -20,8 +20,7 @@ use Aviat\Ion\Config;
class ConfigTest extends Ion_TestCase {
public function setUp()
{
public function setUp(): void {
$this->config = new Config([
'foo' => 'bar',
'asset_path' => '/assets',

View File

@ -33,8 +33,7 @@ class ContainerAwareTest extends Ion_TestCase {
protected $aware;
public function setUp()
{
public function setUp(): void {
$this->container = new Container();
$this->aware = new Aware($this->container);
}

View File

@ -21,6 +21,8 @@ use Aviat\Ion\Di\Exception\ContainerException;
use Aviat\Ion\Tests\Ion_TestCase;
use Monolog\Logger;
use Monolog\Handler\{TestHandler, NullHandler};
use Aviat\Ion\Di\ContainerInterface;
use Aviat\Ion\Di\Exception\NotFoundException;
class FooTest {
@ -37,27 +39,27 @@ class FooTest2 {
class ContainerTest extends Ion_TestCase {
public function setUp()
public function setUp(): void
{
$this->container = new Container();
}
public function dataGetWithException()
public function dataGetWithException(): array
{
return [
'Bad index type: number' => [
'id' => 42,
'exception' => 'Aviat\Ion\Di\Exception\ContainerException',
'exception' => ContainerException::class,
'message' => 'Id must be a string'
],
'Bad index type: array' => [
'id' => [],
'exception' => 'Aviat\Ion\Di\Exception\ContainerException',
'exception' => ContainerException::class,
'message' => 'Id must be a string'
],
'Non-existent id' => [
'id' => 'foo',
'exception' => 'Aviat\Ion\Di\Exception\NotFoundException',
'exception' => NotFoundException::class,
'message' => "Item 'foo' does not exist in container."
]
];
@ -66,7 +68,7 @@ class ContainerTest extends Ion_TestCase {
/**
* @dataProvider dataGetWithException
*/
public function testGetWithException($id, $exception, $message)
public function testGetWithException($id, $exception, $message): void
{
try
{
@ -82,24 +84,24 @@ class ContainerTest extends Ion_TestCase {
/**
* @dataProvider dataGetWithException
*/
public function testGetNewWithException($id, $exception, $message)
public function testGetNewWithException($id, $exception, $message): void
{
$this->expectException($exception);
$this->expectExceptionMessage($message);
$this->container->getNew($id);
}
public function dataSetInstanceWithException()
public function dataSetInstanceWithException(): array
{
return [
'Non-existent id' => [
'id' => 'foo',
'exception' => 'Aviat\Ion\Di\Exception\NotFoundException',
'exception' => NotFoundException::class,
'message' => "Factory 'foo' does not exist in container. Set that first.",
],
'Non-existent id 2' => [
'id' => 'foobarbaz',
'exception' => 'Aviat\Ion\Di\Exception\NotFoundException',
'exception' => NotFoundException::class,
'message' => "Factory 'foobarbaz' does not exist in container. Set that first.",
],
];
@ -108,7 +110,7 @@ class ContainerTest extends Ion_TestCase {
/**
* @dataProvider dataSetInstanceWithException
*/
public function testSetInstanceWithException($id, $exception, $message)
public function testSetInstanceWithException($id, $exception, $message): void
{
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);
});
// Check that the item is the container, if called without arguments
$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']);
$this->assertEquals('Test String', $footest2->item);
}
public function testSetContainerInInstance()
public function testSetContainerInInstance(): void
{
$this->container->set('footest2', function() {
return new FooTest2();
@ -145,36 +147,36 @@ class ContainerTest extends Ion_TestCase {
$this->assertEquals($this->container, $footest2->getContainer());
}
public function testGetNewReturnCallable()
public function testGetNewReturnCallable(): void
{
$this->container->set('footest', function($item) {
return function() use ($item) {
$this->container->set('footest', static function($item) {
return static function() use ($item) {
return $item;
};
});
// Check that the item is the container, if called without arguments
$footest1 = $this->container->getNew('footest');
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $footest1());
$this->assertInstanceOf(ContainerInterface::class, $footest1());
$footest2 = $this->container->getNew('footest', ['Test String']);
$this->assertEquals('Test String', $footest2());
}
public function testGetSet()
public function testGetSet(): void
{
$container = $this->container->set('foo', function() {
return function() {};
$container = $this->container->set('foo', static function() {
return static function() {};
});
$this->assertInstanceOf(Container::class, $container);
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $container);
$this->assertInstanceOf(ContainerInterface::class, $container);
// The factory returns a callable
$this->assertTrue(is_callable($container->get('foo')));
}
public function testLoggerMethods()
public function testLoggerMethods(): void
{
// Does the container have the default logger?
$this->assertFalse($this->container->hasLogger());
@ -189,8 +191,8 @@ class ContainerTest extends Ion_TestCase {
$container = $this->container->setLogger($logger1);
$container2 = $this->container->setLogger($logger2, 'test');
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $container);
$this->assertInstanceOf('Aviat\Ion\Di\Container', $container2);
$this->assertInstanceOf(ContainerInterface::class, $container);
$this->assertInstanceOf(Container::class, $container2);
$this->assertEquals($logger1, $this->container->getLogger('default'));
$this->assertEquals($logger2, $this->container->getLogger('test'));

View File

@ -26,8 +26,7 @@ class EnumTest extends Ion_TestCase {
'FOOBAR' => 'baz'
];
public function setUp()
{
public function setUp(): void {
parent::setUp();
$this->enum = new TestEnum();
}

View File

@ -21,8 +21,7 @@ use Aviat\Ion\Tests\FriendTestClass;
class FriendTest extends Ion_TestCase {
public function setUp()
{
public function setUp(): void {
parent::setUp();
$obj = new FriendTestClass();
$this->friend = new Friend($obj);

View File

@ -18,11 +18,8 @@ namespace Aviat\Ion\Tests;
use function Aviat\Ion\_dir;
use Aura\Web\WebFactory;
use Aviat\Ion\Json;
use PHPUnit\Framework\TestCase;
use Zend\Diactoros\ServerRequestFactory;
use Zend\Diactoros\Response as HttpResponse;
define('ROOT_DIR', realpath(__DIR__ . '/../') . '/');
define('SRC_DIR', ROOT_DIR . 'src/');
@ -34,10 +31,10 @@ define('TEST_VIEW_DIR', __DIR__ . '/test_views');
*/
class Ion_TestCase extends TestCase {
// Test directory constants
const ROOT_DIR = ROOT_DIR;
const SRC_DIR = SRC_DIR;
const TEST_DATA_DIR = TEST_DATA_DIR;
const TEST_VIEW_DIR = TEST_VIEW_DIR;
public const ROOT_DIR = ROOT_DIR;
public const SRC_DIR = SRC_DIR;
public const TEST_DATA_DIR = TEST_DATA_DIR;
public const TEST_VIEW_DIR = TEST_VIEW_DIR;
protected $container;
protected static $staticContainer;
@ -51,7 +48,7 @@ class Ion_TestCase extends TestCase {
self::$session_handler = $session_handler;
}*/
public function setUp()
public function setUp(): void
{
parent::setUp();
@ -100,7 +97,7 @@ class Ion_TestCase extends TestCase {
// Set up DI container
$di = require('di.php');
$container = $di($config_array);
$container->set('session-handler', function() {
$container->set('session-handler', static function() {
// Use mock session handler
$session_handler = new TestSessionHandler();
session_set_save_handler($session_handler, TRUE);
@ -116,7 +113,7 @@ class Ion_TestCase extends TestCase {
* @param array $supers
* @return void
*/
public function setSuperGlobals(array $supers = [])
public function setSuperGlobals(array $supers = []): void
{
$default = [
'_SERVER' => $_SERVER,
@ -127,7 +124,7 @@ class Ion_TestCase extends TestCase {
];
$request = call_user_func_array(
['Zend\Diactoros\ServerRequestFactory', 'fromGlobals'],
[ServerRequestFactory::class, 'fromGlobals'],
array_merge($default, $supers)
);
$this->container->setInstance('request', $request);

View File

@ -24,8 +24,7 @@ class StringWrapperTest extends TestCase {
protected $wrapper;
public function setUp()
{
public function setUp(): void {
$this->wrapper = new class {
use StringWrapper;
};

View File

@ -25,8 +25,7 @@ class AbstractTransformerTest extends Ion_TestCase {
protected $untransformer;
public function setUp()
{
public function setUp(): void {
$this->transformer = new TestTransformer();
$this->untransformer = new TestTransformerUntransform();
}

View File

@ -22,8 +22,7 @@ use Aviat\Ion\Tests\Ion_TestCase;
class ArrayTypeTest extends Ion_TestCase {
use ArrayWrapper;
public function setUp()
{
public function setUp(): void {
parent::setUp();
}

View File

@ -24,8 +24,7 @@ class HtmlViewTest extends HttpViewTest {
protected $template_path;
public function setUp()
{
public function setUp(): void {
parent::setUp();
$this->view = new TestHtmlView($this->container);
}

View File

@ -26,8 +26,7 @@ class HttpViewTest extends Ion_TestCase {
protected $view;
protected $friend;
public function setUp()
{
public function setUp(): void {
parent::setUp();
$this->view = new TestHttpView($this->container);
$this->friend = new Friend($this->view);

View File

@ -21,8 +21,7 @@ use Aviat\Ion\Tests\TestJsonView;
class JsonViewTest extends HttpViewTest {
public function setUp()
{
public function setUp(): void {
parent::setUp();
$this->view = new TestJsonView($this->container);

View File

@ -1,17 +1,17 @@
<?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
*
* @package Ion
* @package HummingbirdAnimeClient
* @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
* @version 2.4.1
* @link https://git.timshomepage.net/timw4mail/ion
* @version 4.1
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\Ion\Tests;
@ -26,8 +26,7 @@ class XMLTest extends TestCase {
protected $object;
protected $array;
public function setUp()
{
public function setUp(): void {
$this->xml = file_get_contents(__DIR__ . '/test_data/XML/xmlTestFile.xml');
$this->expectedXml = file_get_contents(__DIR__ . '/test_data/XML/minifiedXmlTestFile.xml');