Added PHP 8 compatibility.

This commit is contained in:
Klaus Silveira
2022-01-13 18:58:29 -05:00
parent 434521a4e7
commit fff2aad0e5
8 changed files with 2100 additions and 674 deletions

39
.github/workflows/php.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- 7.4
- 8.0
- 8.1
steps:
- uses: actions/checkout@v2
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suite
run: composer run-script test

1
.gitignore vendored
View File

@@ -35,3 +35,4 @@ phpunit.xml
.php_cs.cache
web.config
.vscode/
.phpunit.result.cache

View File

@@ -1,22 +0,0 @@
language: php
php:
- 5.6
- 7.0
- 7.1
install:
- travis_retry composer install --no-interaction --ignore-platform-reqs
script:
- vendor/bin/phpunit --verbose
matrix:
fast_finish: true
include:
- php: 5.3
dist: precise
- php: 5.4
dist: trusty
- php: 5.5
dist: trusty

View File

@@ -1,7 +1,7 @@
<p align="left"><img src="logo/horizontal.png" alt=gitlist" height="120px"></p>
# GitList: an elegant git repository viewer
[![Build Status](https://secure.travis-ci.org/klaussilveira/gitlist.png)](http://travis-ci.org/klaussilveira/gitlist)
![Build Status](https://github.com/klaussilveira/gitlist/actions/workflows/php.yml/badge.svg)
GitList is an elegant and modern web interface for interacting with multiple git repositories. It allows you to browse repositories using your favorite browser, viewing files under different revisions, commit history, diffs. It also generates RSS feeds for each repository, allowing you to stay up-to-date with the latest changes anytime, anywhere. GitList was written in PHP, on top of the [Silex](http://silex.sensiolabs.org/) microframework and powered by the Twig template engine. This means that GitList is easy to install and easy to customize. Also, the GitList gorgeous interface was made possible due to [Bootstrap](http://twitter.github.com/bootstrap/).

View File

@@ -1,26 +1,36 @@
{
"name": "klaussilveira/gitlist",
"description": "An elegant git repository viewer",
"license": "BSD-2-Clause",
"require": {
"php": ">=5.3",
"doctrine/instantiator": "1.0.*",
"klaussilveira/gitter": "^0.4.0",
"phpdocumentor/reflection-docblock": "2.0.*",
"sebastian/comparator": "1.2.*",
"sebastian/recursion-context": "1.0.*",
"silex/silex": "1.3.*",
"symfony/filesystem": "2.8.*",
"symfony/http-kernel": "2.8.*",
"symfony/process": "2.8.*",
"symfony/twig-bridge": "2.8.*",
"twig/twig": "1.35.*"
"klaussilveira/gitter": "^1.0",
"silex/silex": "^1.3",
"symfony/filesystem": "^2.8",
"symfony/http-kernel": "^2.8",
"symfony/process": "^2.8",
"symfony/twig-bridge": "^2.8",
"twig/twig": "^1.35"
},
"require-dev": {
"symfony/browser-kit": "~2.8",
"symfony/css-selector": "~2.8",
"phpunit/phpunit": "~4.8"
"symfony/browser-kit": "^2.8",
"symfony/css-selector": "^2.8",
"phpunit/phpunit": "^9.5",
"rector/rector": "0.12.x-dev"
},
"minimum-stability": "stable",
"scripts": {
"test": [
"@unit",
"@lint"
],
"lint": [
"find src -name '*.php' -print0 | xargs -0 -n1 -P8 php -l"
],
"unit": [
"vendor/bin/phpunit"
]
},
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"GitList\\": "src/"

2608
composer.lock generated

File diff suppressed because it is too large Load Diff

56
src/Test/WebTestCase.php Normal file
View File

@@ -0,0 +1,56 @@
<?php
namespace GitList\Test;
use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use PHPUnit\Framework\TestCase;
/**
* WebTestCase is the base class for functional tests.
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
abstract class WebTestCase extends TestCase
{
/**
* HttpKernelInterface instance.
*
* @var HttpKernelInterface
*/
protected $app;
/**
* PHPUnit setUp for setting up the application.
*
* Note: Child classes that define a setUp method must call
* parent::setUp().
*/
public function setUp(): void
{
$this->app = $this->createApplication();
}
/**
* Creates the application.
*
* @return HttpKernelInterface
*/
abstract public function createApplication();
/**
* Creates a Client.
*
* @param array $server Server parameters
*
* @return Client A Client instance
*/
public function createClient(array $server = array())
{
if (!class_exists('Symfony\Component\BrowserKit\Client')) {
throw new \LogicException('Component "symfony/browser-kit" is required by WebTestCase.'.PHP_EOL.'Run composer require symfony/browser-kit');
}
return new Client($this->app, $server);
}
}

View File

@@ -1,7 +1,7 @@
<?php
use GitList\Test\WebTestCase;
use GitList\Git\Client;
use Silex\WebTestCase;
use Symfony\Component\Filesystem\Filesystem;
class InterfaceTest extends WebTestCase
@@ -9,7 +9,7 @@ class InterfaceTest extends WebTestCase
protected static $tmpdir;
protected static $gitPath;
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
if (sys_get_temp_dir()) {
self::$tmpdir = sys_get_temp_dir();
@@ -134,7 +134,7 @@ class InterfaceTest extends WebTestCase
$repository->commit('First commit');
}
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
$fs = new Filesystem();
$fs->remove(self::$tmpdir);