Browse files

Added replacement for CACHE_LITE_ERROR_DIE test.

  • Loading branch information...
1 parent c1260db commit cfb4306d84764f285ce74ba3578318f970314ae5 @coderbyheart coderbyheart committed Jan 5, 2012
Showing with 53 additions and 0 deletions.
  1. +30 −0 tests/ErrorDieTest.php
  2. +23 −0 tests/errordie.php
View
30 tests/ErrorDieTest.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * Test for CACHE_LITE_ERROR_DIE
+ *
+ * @package Cache_Lite
+ * @category Caching
+ * @version $Id$
+ * @author Markus Tacker <tacker@php.net>
+ */
+
+require_once 'tmpdir.inc';
+
+class ErrorDieTest extends PHPUnit_Framework_TestCase
+{
+ public function testErrorDie()
+ {
+ exec('/usr/bin/env php ' . __DIR__ . DIRECTORY_SEPARATOR . 'errordie.php', $out);
+ $message = join(PHP_EOL, $out);
+ $message = str_replace(tmpDir(), '<cachedir>/', $message); // Remove system specific cache dir
+ $expected = join(PHP_EOL, array(
+ '==> First call (cache should be missed)',
+ 'Cache Missed !',
+ '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789Cache_Lite : Unable to write cache file : <cachedir>/31451992gjhgjh/cache_c21f969b5f03d33d43e04f8f136e7682_e9982ec5ca981bd365603623cf4b2277',
+ ));
+
+ $this->assertEquals($message, $expected);
+
+ }
+}
View
23 tests/errordie.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * Executed by ErrorDieTest
+ *
+ * @package Cache_Lite
+ * @category Caching
+ * @version $Id$
+ * @author Markus Tacker <tacker@php.net>
+ */
+
+require_once 'callcache.inc';
+require_once 'tmpdir.inc';
+require_once 'cache_lite_base.inc';
+
+$options = array(
+ 'cacheDir' => tmpDir() . '31451992gjhgjh'. '/', # I hope there will be no directory with that silly name
+ 'lifeTime' => 60,
+ 'pearErrorMode' => CACHE_LITE_ERROR_DIE
+);
+
+$Cache_Lite = new Cache_Lite($options);
+multipleCallCache();

0 comments on commit cfb4306

Please sign in to comment.