Permalink
Browse files

Add APCu test

  • Loading branch information...
1 parent a13888f commit 47f441700c26c93a864889229570ad77cee7b91b @phadej phadej committed Nov 10, 2013
Showing with 50 additions and 0 deletions.
  1. +13 −0 README.md
  2. +1 −0 tests/igbinary_045.phpt
  3. +36 −0 tests/igbinary_045b.phpt
View
@@ -93,6 +93,19 @@ option must be given to configure script: "--with-php-config=.../php-config5"
5. `make install`
6. igbinary.so is installed to the default extension directory
+### To run APCu test
+
+```
+# go to modules directory
+cd modules
+
+# ... and create symlink to apcu extension
+# it will be loaded during test suite
+/opt/lib/php/extensions/no-debug-non-zts-20121212/apcu.so
+```
+
+Similar approach should work for APC.
+
Bugs & Contributions
--------------------
@@ -12,6 +12,7 @@ if (version_compare($ext->getVersion(), '3.1.7', '<')) {
}
--INI--
+extension=apc.so
apc.enable_cli=1
apc.serializer=igbinary
--FILE--
@@ -0,0 +1,36 @@
+--TEST--
+APCu serializer registration
+--SKIPIF--
+<?php
+if (!extension_loaded('apcu')) {
+ echo "skip APCu not loaded";
+}
+
+$ext = new ReflectionExtension('apcu');
+if (version_compare($ext->getVersion(), '4.0.2', '<')) {
+ echo "skip require APCu version 4.0.2 or above";
+}
+
+--INI--
+extension=apcu.so
+apc.enable_cli=1
+apc.serializer=igbinary
+--FILE--
+<?php
+echo ini_get('apc.serializer'), "\n";
+
+class Bar {
+ public $foo = 10;
+}
+
+$a = new Bar;
+apc_store('foo', $a);
+unset($a);
+
+var_dump(apc_fetch('foo'));
+--EXPECTF--
+igbinary
+object(Bar)#%d (1) {
+ ["foo"]=>
+ int(10)
+}

0 comments on commit 47f4417

Please sign in to comment.