Skip to content

Commit

Permalink
ModelsMetadataAdaptersTest: XCache adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jul 17, 2013
1 parent 81e6f27 commit b5ff26d
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion unit-tests/ModelsMetadataAdaptersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
+------------------------------------------------------------------------+
*/

require_once 'helpers/xcache.php';

class ModelsMetadataAdaptersTest extends PHPUnit_Framework_TestCase
{

Expand Down Expand Up @@ -164,7 +166,7 @@ public function testMetadataSession()
public function testMetadataApc()
{

if (!extension_loaded('apc')) {
if (!function_exists('apc_fetch')) {
$this->markTestSkipped('apc extension is not loaded');
return false;
}
Expand Down Expand Up @@ -197,6 +199,42 @@ public function testMetadataApc()

}

public function testMetadataXcache()
{

if (!function_exists('xcache_get')) {
$this->markTestSkipped('xcache extension is not loaded');
return false;
}

xcache_unset('$PMM$my-local-app');

$di = $this->_getDI();

$di->set('modelsMetadata', function(){
return new Phalcon\Mvc\Model\Metadata\Xcache(array(
'prefix' => 'my-local-app',
'lifetime' => 60
));
});

$metaData = $di->getShared('modelsMetadata');

$metaData->reset();

$this->assertTrue($metaData->isEmpty());

Robots::findFirst();

$this->assertEquals(apc_fetch('$PMM$my-local-appmeta-robots-robots'), $this->_data['meta-robots-robots']);
$this->assertEquals(apc_fetch('$PMM$my-local-appmap-robots'), $this->_data['map-robots']);

$this->assertFalse($metaData->isEmpty());

Robots::findFirst();

}

public function testMetadataFiles()
{

Expand Down

0 comments on commit b5ff26d

Please sign in to comment.