Skip to content

Commit f9731ce

Browse files
authored
Switch to phpunit polyfills (#10)
1 parent a3a946b commit f9731ce

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ jobs:
99
- '5.6'
1010
- '7.0'
1111
- '7.4'
12+
- '8.2'
1213
name: PHP ${{ matrix.php-version }} sample
1314
steps:
1415
- uses: actions/checkout@v3
1516
- uses: shivammathur/setup-php@v2
1617
with:
1718
php-version: ${{ matrix.php-version }}
18-
- run: |
19-
curl -s http://getcomposer.org/installer | php
20-
php composer.phar install
19+
tools: composer
20+
- run: composer install
2121
- env:
2222
DETECTLANGUAGE_API_KEY: ${{ secrets.DETECTLANGUAGE_API_KEY }}
2323
run: bin/phpunit

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"php": ">=5.3.0"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "~4.0"
18+
"yoast/phpunit-polyfills": "^1.0"
1919
},
2020
"config": {
2121
"bin-dir": "bin"

tests/DetectLanguage/DetectLanguageTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
namespace DetectLanguage\Test;
44

55
use \DetectLanguage\DetectLanguage;
6+
use \Yoast\PHPUnitPolyfills\TestCases\TestCase;
67

7-
class DetectLanguageTest extends \PHPUnit_Framework_TestCase
8+
class DetectLanguageTest extends TestCase
89
{
9-
public function setUp()
10+
public function set_up()
1011
{
12+
parent::set_up();
13+
1114
DetectLanguage::$apiKey = getenv('DETECTLANGUAGE_API_KEY');
1215
DetectLanguage::$apiVersion = '0.2';
1316
}
@@ -63,7 +66,7 @@ public function testSecureRequest()
6366

6467
public function testInvalidApiKey()
6568
{
66-
$this->setExpectedException('\DetectLanguage\Error');
69+
$this->expectException('\DetectLanguage\Error');
6770

6871
DetectLanguage::setApiKey('invalid');
6972

@@ -72,7 +75,7 @@ public function testInvalidApiKey()
7275

7376
public function testErrorBackwardsCompatibility()
7477
{
75-
$this->setExpectedException('\DetectLanguage\DetectLanguageError');
78+
$this->expectException('\DetectLanguage\DetectLanguageError');
7679

7780
DetectLanguage::setApiKey('invalid');
7881

@@ -81,7 +84,7 @@ public function testErrorBackwardsCompatibility()
8184

8285
public function testInvalidResponse()
8386
{
84-
$this->setExpectedException('\DetectLanguage\Error');
87+
$this->expectException('\DetectLanguage\Error');
8588

8689
DetectLanguage::$apiVersion = '0.0';
8790
DetectLanguage::simpleDetect('Hello world');

0 commit comments

Comments
 (0)