Using APCu in phpunit

php

#1

I have some tests using the apcu extension: https://github.com/aguimaraes/circuit-breaker/blob/72db3873c6956f8a8b025028e90f007dc34f1a5f/tests/Adapter/APCuTest.php

For some reason apcu_fetch always return false.

am I missing something here? I can’t put that simple test to work.

I’m using:

  • php 5.6.17

  • xdebug 2.33

  • phpunit 5.7.20

  • apcu 4.0.11 (enabled)

    ubuntu@box661:~/circuit-breaker$ php -a
    Interactive shell

    php > $myVar = 40;
    php > apcu_store(‘my-key’, $myVar);
    php > var_dump(apcu_fetch(‘my-key’));
    bool(false)
    php >

Thank you in advance.


#2

If you are from Google search: you need apc.enable_cli=‘on’ in php.ini


#3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.