Skip to content

Commit e27027a

Browse files
authored
Merge pull request #52 from nojimage/php-56-test
Add test and CI for PHP 5.6
2 parents 4973312 + 51603b2 commit e27027a

6 files changed

Lines changed: 400 additions & 6 deletions

File tree

.travis.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@ php:
55
- 7.4
66
- 'nightly'
77

8+
env:
9+
global:
10+
- DEFAULT=1
11+
812
matrix:
913
include:
1014
- php: 7.2
11-
env: PHPCS=1
15+
env: PHPCS=1 DEFAULT=0
16+
17+
- php: 5.6
18+
env: PHP56=1 DEFAULT=0
1219

1320
install:
1421
- composer install --no-interaction
1522

1623
script:
17-
- if [[ $PHPCS != 1 ]]; then vendor/bin/phpunit; fi
24+
- if [[ $DEFAULT == 1 ]]; then vendor/bin/phpunit; fi
25+
- if [[ $PHP56 == 1 ]]; then vendor/bin/phpunit tests/php56/; fi
1826
- if [[ $PHPCS == 1 ]]; then vendor/bin/phpcs -p -n --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi
1927

2028
notifications:

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"require-dev": {
1717
"cakephp/cakephp-codesniffer": "^3.3",
1818
"composer/composer": "^2.0",
19-
"phpunit/phpunit": "^8.5 || ^9.3"
19+
"phpunit/phpunit": "^5.7 || ^6.5 || ^8.5 || ^9.3"
2020
},
2121
"autoload": {
2222
"psr-4": {
@@ -25,7 +25,8 @@
2525
},
2626
"autoload-dev": {
2727
"psr-4": {
28-
"Cake\\Test\\TestCase\\Composer\\": "tests/"
28+
"Cake\\Test\\TestCase\\Composer\\": "tests/TestCase/",
29+
"Cake\\Test\\TestCase\\Composer\\Php56\\": "tests/php56/TestCase/"
2930
}
3031
},
3132
"extra": {

src/Installer/PluginInstaller.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
declare(strict_types=1);
3-
42
namespace Cake\Composer\Installer;
53

64
use Composer\Installer\LibraryInstaller;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
namespace Cake\Test\TestCase\Composer\Php56\Installer;
3+
4+
use Cake\Composer\Installer\PluginInstaller;
5+
use Composer\Composer;
6+
use Composer\IO\IOInterface;
7+
use Composer\Package\RootPackage;
8+
use Composer\Script\Event;
9+
use PHPUnit\Framework\TestCase;
10+
11+
class PluginInstallerTest extends TestCase
12+
{
13+
/**
14+
* setUp
15+
*
16+
* @return void
17+
*/
18+
public function setUp()
19+
{
20+
parent::setUp();
21+
22+
$this->composer = new Composer();
23+
$this->io = $this->getMockBuilder(IOInterface::class)->getMock();
24+
}
25+
26+
public function testPostAutoloadDump()
27+
{
28+
$rootPackage = new RootPackage('cakephp/app', '1.0', '1.0');
29+
$rootPackage->setType('project');
30+
$rootPackage->setScripts([
31+
'post-autoload-dump' => 'Cake\Composer\Installer\PluginInstaller::postAutoloadDump',
32+
]);
33+
34+
$this->composer->setPackage($rootPackage);
35+
$this->io->expects($this->once())
36+
->method('write');
37+
38+
$event = new Event('post-autoload-dump', $this->composer, $this->io);
39+
40+
PluginInstaller::postAutoloadDump($event);
41+
}
42+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Cake\Test\TestCase\Composer\Php56;
4+
5+
trait PHPUnitAssertionCompatTrait
6+
{
7+
public function assertStringContainsString($needle, $haystack, $message = '')
8+
{
9+
$this->assertContains($needle, $haystack, $message);
10+
}
11+
}

0 commit comments

Comments
 (0)