Skip to content

Commit f5d407e

Browse files
authored
Update composer requirements (#9)
- Use phpunit 8 - Update unit tests - Only add supported symfony versions to composer.json - Only add supported php version to travis.yaml
1 parent 121431f commit f5d407e

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

.travis.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
language: php
22

33
php:
4-
- 7.1
54
- 7.2
5+
- 7.3
6+
- 7.4
67

78
branches:
89
only:
910
- master
1011

1112
matrix:
1213
include:
13-
- php: 7.2
14-
env: SYMFONY_VERSION='3.3.*'
15-
- php: 7.2
14+
- php: 7.4
1615
env: SYMFONY_VERSION='3.4.*'
17-
- php: 7.2
18-
env: SYMFONY_VERSION='4.0.*'
16+
- php: 7.4
17+
env: SYMFONY_VERSION='4.3.*'
18+
- php: 7.4
19+
env: SYMFONY_VERSION='4.4.*'
20+
- php: 7.4
21+
env: SYMFONY_VERSION='5.0.*'
1922
fast_finish: true
2023
allow_failures:
2124
- php: nightly
@@ -25,4 +28,4 @@ before_script:
2528
- sh -c 'if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev --no-update symfony/symfony=$SYMFONY_VERSION; fi;'
2629
- composer update --prefer-source
2730

28-
script: phpunit
31+
script: vendor/bin/phpunit

Tests/DependencyInjection/Zeichen32GitLabApiExtensionTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
namespace Zeichen32\GitLabApiBundle\Tests\DependencyInjection;
1212

13+
use Http\Client\HttpClient;
1314
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1416
use Symfony\Component\DependencyInjection\ContainerBuilder;
1517
use Symfony\Component\DependencyInjection\Definition;
1618
use Zeichen32\GitLabApiBundle\DependencyInjection\Zeichen32GitLabApiExtension;
@@ -27,13 +29,13 @@ class Zeichen32GitLabApiExtensionTest extends TestCase {
2729
private $extension;
2830

2931

30-
public function setUp()
32+
public function setUp(): void
3133
{
3234
$this->container = new ContainerBuilder();
3335
$this->extension = new Zeichen32GitLabApiExtension();
3436
}
3537

36-
public function tearDown()
38+
public function tearDown(): void
3739
{
3840
unset($this->container, $this->extension);
3941
}
@@ -64,10 +66,9 @@ public function testCreateClients()
6466
);
6567
}
6668

67-
/**
68-
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
69-
*/
7069
public function testWrongAuthMethod() {
70+
$this->expectException(InvalidConfigurationException::class);
71+
7172
$config = array(
7273
'zeichen32_git_lab_api' => array('clients' => array(
7374
'firstclient' => array(
@@ -130,21 +131,22 @@ public function testHttpClients() {
130131
)),
131132
);
132133

133-
$httpClient = $this->createMock('Http\Client\HttpClient');
134-
$this->container->setDefinition('http.client', new Definition($httpClient));
134+
$httpClient = $this->createMock(HttpClient::class);
135+
$this->container->setDefinition('http.client', new Definition(HttpClient::class));
136+
$this->container->set('http.client', $httpClient);
135137

136138
$this->extension->load($config, $this->container);
137139

138140
$firstClient = $this->container->get('zeichen32_gitlabapi.client.firstclient');
139141
$secondClient = $this->container->get('zeichen32_gitlabapi.client.secondclient');
140142

141143
$this->assertInstanceOf(
142-
'Http\Client\HttpClient',
144+
HttpClient::class,
143145
$firstClient->getHttpClient()
144146
);
145147

146148
$this->assertInstanceOf(
147-
'Http\Client\HttpClient',
149+
HttpClient::class,
148150
$secondClient->getHttpClient()
149151
);
150152
}

Tests/Zeichen32GitLabApiBundleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Time: 14:15
99
*/
1010

11-
namespace Zeichen32\GitLabApiBundle;
11+
namespace Zeichen32\GitLabApiBundle\Tests;
1212

1313
use PHPUnit\Framework\TestCase;
1414
use Zeichen32\GitLabApiBundle\Zeichen32GitLabApiBundle;

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^5.6 || ^7.0",
16-
"symfony/framework-bundle": "^2.6|^3.0|^4.0|^5.0",
15+
"php": "^7.2",
16+
"symfony/framework-bundle": "^3.4|^4.3|^5.0",
1717
"m4tthumphrey/php-gitlab-api": "^9"
1818
},
1919
"require-dev" : {
2020
"php-http/message": "^1.6",
2121
"php-http/guzzle6-adapter": "^1.1",
22-
"phpunit/phpunit": "~6.5"
22+
"phpunit/phpunit": "^8.0"
2323
},
2424
"autoload": {
2525
"psr-0": { "Zeichen32\\GitLabApiBundle": "" }

0 commit comments

Comments
 (0)