Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit eea2b01

Browse files
committed
Allow testing against stable dependencies
- Updated versions for: - zend-stdlib (allow either 2.7 or 3.0 series) - zend-sessionmanager (for 3.0, pin to `^3.0.3` to ensure compat trait is present) - zend-session `^2.5` - Set branch-alias for develop back to 2.6-dev - Test both eventmanager versions! - Remove zend-session when testing against zend-servicemanager v3, as it's not yet forwards-compatible; skip tests for the Session adapter as well. Additionally, updates tests that introspect listeners: - Removed custom EventManagerIntrospectionTrait in favor of the one EventListenerIntrospectionTrait shipped with zend-eventmanager. - Updated all tests that used the trait to use the official one, fixing failing tests.
1 parent 38d15f1 commit eea2b01

9 files changed

+54
-171
lines changed

.travis.yml

+22-15
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ services:
1818

1919
env:
2020
global:
21-
- TESTS_ZEND_CACHE_APC_ENABLED=true
22-
- TESTS_ZEND_CACHE_MEMCACHED_ENABLED=true
23-
- TESTS_ZEND_CACHE_MEMCACHED_HOST='127.0.0.1'
24-
- TESTS_ZEND_CACHE_MEMCACHED_PORT=11211
25-
- TESTS_ZEND_CACHE_MEMCACHE_ENABLED=true
26-
- TESTS_ZEND_CACHE_MEMCACHE_HOST=$TESTS_ZEND_CACHE_MEMCACHED_HOST
27-
- TESTS_ZEND_CACHE_MEMCACHE_PORT=$TESTS_ZEND_CACHE_MEMCACHED_PORT
28-
- TESTS_ZEND_CACHE_MONGODB_ENABLED=true
29-
- TESTS_ZEND_CACHE_REDIS_ENABLED=true
30-
- TESTS_ZEND_CACHE_REDIS_HOST='127.0.0.1'
31-
- TESTS_ZEND_CACHE_REDIS_PORT=6379
32-
- TESTS_ZEND_CACHE_REDIS_PASSWORD=''
33-
- TESTS_ZEND_CACHE_REDIS_DATABASE=0
21+
- TESTS_ZEND_CACHE_APC_ENABLED: true
22+
- TESTS_ZEND_CACHE_MEMCACHED_ENABLED: true
23+
- TESTS_ZEND_CACHE_MEMCACHED_HOST: "127.0.0.1"
24+
- TESTS_ZEND_CACHE_MEMCACHED_PORT: 11211
25+
- TESTS_ZEND_CACHE_MEMCACHE_ENABLED: true
26+
- TESTS_ZEND_CACHE_MEMCACHE_HOST: $TESTS_ZEND_CACHE_MEMCACHED_HOST
27+
- TESTS_ZEND_CACHE_MEMCACHE_PORT: $TESTS_ZEND_CACHE_MEMCACHED_PORT
28+
- TESTS_ZEND_CACHE_MONGODB_ENABLED: true
29+
- TESTS_ZEND_CACHE_REDIS_ENABLED: true
30+
- TESTS_ZEND_CACHE_REDIS_HOST: "127.0.0.1"
31+
- TESTS_ZEND_CACHE_REDIS_PORT: 6379
32+
- TESTS_ZEND_CACHE_REDIS_PASSWORD: ""
33+
- TESTS_ZEND_CACHE_REDIS_DATABASE: 0
3434

3535
matrix:
3636
fast_finish: true
@@ -42,6 +42,7 @@ matrix:
4242
- php: 5.5
4343
env:
4444
- SERVICE_MANAGER_VERSION="^2.7.5"
45+
- EVENT_MANAGER_VERSION="^2.6.2"
4546
- PECL_INSTALL_APCU='apcu-4.0.8'
4647
- php: 5.6
4748
env:
@@ -50,6 +51,7 @@ matrix:
5051
- php: 5.6
5152
env:
5253
- SERVICE_MANAGER_VERSION="^2.7.5"
54+
- EVENT_MANAGER_VERSION="^2.6.2"
5355
- PECL_INSTALL_APCU='apcu-4.0.8'
5456
- php: 7
5557
env:
@@ -58,12 +60,14 @@ matrix:
5860
- php: 7
5961
env:
6062
- SERVICE_MANAGER_VERSION="^2.7.5"
63+
- EVENT_MANAGER_VERSION="^2.6.2"
6164
- PECL_INSTALL_APCU='apcu'
6265
- PECL_INSTALL_APCU_BC='apcu_bc-beta'
6366
- php: hhvm
6467
- php: hhvm
6568
env:
6669
- SERVICE_MANAGER_VERSION="^2.7.5"
70+
- EVENT_MANAGER_VERSION="^2.6.2"
6771
allow_failures:
6872
- php: 7
6973
- php: hhvm
@@ -76,8 +80,11 @@ before_install:
7680
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
7781
- composer self-update
7882
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
79-
- if [[ $SERVICE_MANAGER_VERSION != '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:$SERVICE_MANAGER_VERSION" ; fi
80-
- if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:^3.0" ; fi
83+
- if [[ $SERVICE_MANAGER_VERSION != '' ]]; then composer require --no-update "zendframework/zend-servicemanager:$SERVICE_MANAGER_VERSION" ; fi
84+
- if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer require --no-update "zendframework/zend-servicemanager:^3.0.3" ; fi
85+
- if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer remove --dev --no-update zendframework/zend-session ; fi
86+
- if [[ $EVENT_MANAGER_VERSION != '' ]]; then composer require --no-update "zendframework/zend-eventmanager:$EVENT_MANAGER_VERSION" ; fi
87+
- if [[ $EVENT_MANAGER_VERSION == '' ]]; then composer require --no-update "zendframework/zend-eventmanager:^3.0" ; fi
8188

8289
install:
8390
- travis_retry composer install --no-interaction --ignore-platform-reqs

composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
}
1414
},
1515
"require": {
16-
"php": ">=5.5",
17-
"zendframework/zend-stdlib": "~2.7",
18-
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0",
16+
"php": "^5.5 || ^7.0",
17+
"zendframework/zend-stdlib": "^2.7 || ^3.0",
18+
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
1919
"zendframework/zend-eventmanager": "^2.6.2 || ^3.0"
2020
},
2121
"require-dev": {
22-
"zendframework/zend-serializer": "^2.6.0",
23-
"zendframework/zend-session": "dev-develop as 2.6.0",
22+
"zendframework/zend-serializer": "^2.6",
23+
"zendframework/zend-session": "^2.5",
2424
"fabpot/php-cs-fixer": "1.7.*",
2525
"phpunit/PHPUnit": "~4.0"
2626
},
@@ -42,7 +42,7 @@
4242
"extra": {
4343
"branch-alias": {
4444
"dev-master": "2.5-dev",
45-
"dev-develop": "3.0-dev"
45+
"dev-develop": "2.6-dev"
4646
}
4747
},
4848
"autoload-dev": {

test/EventManagerIntrospectionTrait.php

-136
This file was deleted.

test/Storage/Adapter/SessionTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ class SessionTest extends CommonAdapterTest
2020
{
2121
public function setUp()
2222
{
23+
if (! class_exists(SessionContainer::class)) {
24+
$this->markTestSkipped(
25+
'Skipping zend-session-related tests until that component is '
26+
. 'forwards-compatible with zend-stdlib, zend-servicemanager, '
27+
. 'and zend-eventmanager v3'
28+
);
29+
}
30+
2331
$_SESSION = [];
2432
SessionContainer::setDefaultManager(null);
2533
$sessionContainer = new SessionContainer('Default');
@@ -35,6 +43,10 @@ public function setUp()
3543

3644
public function tearDown()
3745
{
46+
if (! class_exists(SessionContainer::class)) {
47+
return;
48+
}
49+
3850
$_SESSION = [];
3951
SessionContainer::setDefaultManager(null);
4052
}

test/Storage/Plugin/ClearExpiredByFactorTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
namespace ZendTest\Cache\Storage\Plugin;
1111

12+
use ArrayObject;
1213
use Zend\Cache;
1314
use Zend\Cache\Storage\PostEvent;
15+
use Zend\EventManager\Test\EventListenerIntrospectionTrait;
1416
use ZendTest\Cache\Storage\TestAsset\ClearExpiredMockAdapter;
15-
use ZendTest\Cache\EventManagerIntrospectionTrait;
16-
use ArrayObject;
1717

1818
/**
1919
* @covers Zend\Cache\Storage\Plugin\ClearExpiredByFactor
2020
*/
2121
class ClearExpiredByFactorTest extends CommonPluginTest
2222
{
23-
use EventManagerIntrospectionTrait;
23+
use EventListenerIntrospectionTrait;
2424

2525
/**
2626
* The storage adapter

test/Storage/Plugin/ExceptionHandlerTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
namespace ZendTest\Cache\Storage\Plugin;
1111

12+
use ArrayObject;
1213
use Zend\Cache;
1314
use Zend\Cache\Storage\ExceptionEvent;
15+
use Zend\EventManager\Test\EventListenerIntrospectionTrait;
1416
use ZendTest\Cache\Storage\TestAsset\MockAdapter;
15-
use ArrayObject;
16-
use ZendTest\Cache\EventManagerIntrospectionTrait;
1717

1818
/**
1919
* @covers Zend\Cache\Storage\Plugin\ExceptionHandler<extended>
2020
*/
2121
class ExceptionHandlerTest extends CommonPluginTest
2222
{
23-
use EventManagerIntrospectionTrait;
23+
use EventListenerIntrospectionTrait;
2424

2525
/**
2626
* The storage adapter

test/Storage/Plugin/IgnoreUserAbortTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
use Zend\Cache;
1313
use Zend\Cache\Storage\Event;
14-
use ZendTest\Cache\EventManagerIntrospectionTrait;
14+
use Zend\EventManager\Test\EventListenerIntrospectionTrait;
1515

1616
/**
1717
* @group Zend_Cache
1818
* @covers Zend\Cache\Storage\Plugin\IgnoreUserAbort<extended>
1919
*/
2020
class IgnoreUserAbortTest extends CommonPluginTest
2121
{
22-
use EventManagerIntrospectionTrait;
22+
use EventListenerIntrospectionTrait;
2323

2424
/**
2525
* The storage adapter

test/Storage/Plugin/OptimizeByFactorTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
namespace ZendTest\Cache\Storage\Plugin;
1111

12+
use ArrayObject;
1213
use Zend\Cache;
1314
use Zend\Cache\Storage\PostEvent;
15+
use Zend\EventManager\Test\EventListenerIntrospectionTrait;
1416
use ZendTest\Cache\Storage\TestAsset\OptimizableMockAdapter;
15-
use ArrayObject;
16-
use ZendTest\Cache\EventManagerIntrospectionTrait;
1717

1818
/**
1919
* @covers Zend\Cache\Storage\Plugin\OptimizeByFactor<extended>
2020
*/
2121
class OptimizeByFactorTest extends CommonPluginTest
2222
{
23-
use EventManagerIntrospectionTrait;
23+
use EventListenerIntrospectionTrait;
2424

2525
/**
2626
* The storage adapter

test/Storage/Plugin/SerializerTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99

1010
namespace ZendTest\Cache\Storage\Plugin;
1111

12+
use ArrayObject;
1213
use Zend\Cache;
1314
use Zend\Cache\Storage\Event;
1415
use Zend\Cache\Storage\PostEvent;
15-
use ArrayObject;
16-
use ZendTest\Cache\EventManagerIntrospectionTrait;
16+
use Zend\EventManager\Test\EventListenerIntrospectionTrait;
1717

1818
/**
1919
* @group Zend_Cache
2020
* @covers Zend\Cache\Storage\Plugin\Serializer<extended>
2121
*/
2222
class SerializerTest extends CommonPluginTest
2323
{
24-
use EventManagerIntrospectionTrait;
24+
use EventListenerIntrospectionTrait;
2525

2626
/**
2727
* The storage adapter

0 commit comments

Comments
 (0)