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

Commit

Permalink
fixed #50: run APC(u) tests in travis
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-mabe committed Dec 21, 2015
1 parent 1f8449e commit 6030069
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions .ci/apcu_bc.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension=apc.so
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ matrix:
- php: 5.5
env:
- EXECUTE_CS_CHECK=true
- PECL_INSTALL_APCU='apcu-4.0.8'
- php: 5.6
env:
- EXECUTE_TEST_COVERALLS=true
- PECL_INSTALL_APCU='apcu-4.0.8'
- php: 7
- php: hhvm
env:
- PECL_INSTALL_APCU='apcu'
- PECL_INSTALL_APCU_BC='apcu_bc-beta'
- php: hhvm
allow_failures:
- php: 7
- php: hhvm
Expand All @@ -58,7 +63,13 @@ before_install:

install:
- travis_retry composer install --no-interaction --ignore-platform-reqs
- echo "yes\nno\n" | pecl -d preferred_state=beta install apcu || return 0
- if [[ $PECL_INSTALL_APCU != '' ]]; then echo "yes\nno\n" | pecl install $PECL_INSTALL_APCU || return 0 ; fi

# see https://pear.php.net/bugs/bug.php?id=21007
# pecl install adds the "extension=*.so" directive on top of php.ini which results in wrong extension order
# -> Attach another ini file loading the extension kind of solves the issue.
# The first extension loading still results in a warning but it doesn't break the test
- if [[ $PECL_INSTALL_APCU_BC != '' ]]; then pecl install $PECL_INSTALL_APCU_BC && phpenv config-add .ci/apcu_bc.ini || return 0 ; fi

before_script:
- phpenv config-add .ci/php.ini || return 0
Expand Down
4 changes: 4 additions & 0 deletions src/Storage/Adapter/Apc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class Apc extends AbstractAdapter implements
*/
public function __construct($options = null)
{
if (!extension_loaded('apc')) {
throw new Exception\ExtensionNotLoadedException('Missing ext/apc');
}

$enabled = ini_get('apc.enabled');
if (PHP_SAPI == 'cli') {
$enabled = $enabled && (bool) ini_get('apc.enable_cli');
Expand Down

0 comments on commit 6030069

Please sign in to comment.