Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Tests

on:
pull_request:
push:
branches:
- master
workflow_dispatch:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php: '5.4'
composer: '2.2'
- php: '5.6'
composer: '2.2'
- php: '7.4'
composer: 'v2'
- php: '8.0'
composer: 'v2'
- php: '8.4'
composer: 'v2'
- php: '8.5'
composer: 'v2'

name: PHP ${{ matrix.php }}

steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, ctype
tools: composer:${{ matrix.composer }}
coverage: none

- name: Validate Composer metadata
run: composer validate --strict

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run tests
run: composer test
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Sentence
========
[![License](https://img.shields.io/github/license/vanderlee/php-sentence.svg)]()
[![Build Status](https://travis-ci.org/vanderlee/php-sentence.svg?branch=master)](https://travis-ci.org/vanderlee/php-sentence)
[![Tests](https://github.com/vanderlee/php-sentence/actions/workflows/tests.yml/badge.svg)](https://github.com/vanderlee/php-sentence/actions/workflows/tests.yml)
[![Quality](https://scrutinizer-ci.com/g/vanderlee/php-sentence/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/vanderlee/php-sentence)

Version 1.0.8
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"disambiguation",
"segmentation"
],
"homepage": "https://github.com/vanderlee/php-sentence.git",
"homepage": "https://github.com/vanderlee/php-sentence",
"license": "MIT",
"support": {
"issues": "https://github.com/vanderlee/php-sentence/issues",
Expand All @@ -27,9 +27,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "^3.6.12"
"phpunit/phpunit": "^4.8 || ^5.7 || ^9.6"
},
"scripts": {
"test": "vendor/bin/phpunit"
"test": "phpunit"
}
}
5 changes: 4 additions & 1 deletion tests/SentenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class SentenceTest extends PHPUnit_Framework_TestCase
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
/**
* @before
*/
protected function setUpFixture()
{
$this->object = new Sentence();
}
Expand Down
16 changes: 12 additions & 4 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<?php

if (!class_exists('PHPUnit_Framework_TestCase', false)
&& class_exists('PHPUnit\\Framework\\TestCase')) {
class_alias('PHPUnit\\Framework\\TestCase', 'PHPUnit_Framework_TestCase');
}

spl_autoload_register(function ($class) {
static $prefix = 'Vanderlee\\Sentence\\';
if (stripos($class, $prefix) === 0) {
$file = str_replace('\\', DIRECTORY_SEPARATOR,
dirname(__DIR__).'\\src\\'.str_ireplace($prefix, '', $class).'.php');
$relative = str_ireplace($prefix, '', $class);
$file = dirname(__DIR__)
. DIRECTORY_SEPARATOR . 'src'
. DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $relative)
. '.php';

if (is_file($file)) {
/** @noinspection PhpIncludeInspection */
require_once $file;
}
}
});
});