<?php

namespace CacheTool\Command;

use CacheTool\Console\Application;
use CacheTool\Console\Config;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\BufferedOutput;

abstract class CommandTest extends \PHPUnit_Framework_TestCase
{
    public function runCommand($cmd)
    {
        $app = new Application(new Config(array('adapter' => 'cli')));
        $app->setAutoExit(false);

        $input = new StringInput($cmd);
        $output = new BufferedOutput();

        $app->run($input, $output);

        return $output->fetch();
    }

    protected function assertHasApc()
    {
        if (!extension_loaded('apc')) {
            $this->markTestSkipped('APC extension is not loaded.');
        }
    }

    protected function assertHasOpcache()
    {
        if (!extension_loaded('Zend OPcache')) {
            $this->markTestSkipped('OPcache extension is not loaded.');
        }
    }
}

<?php

namespace CacheTool\Command;

use CacheTool\Console\Application;
use CacheTool\Console\Config;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\BufferedOutput;

abstract class CommandTest extends \PHPUnit_Framework_TestCase
{
    public function runCommand($cmd)
    {
        $app = new Application(new Config(array('adapter' => 'cli')));
        $app->setAutoExit(false);

        $input = new StringInput($cmd);
        $output = new BufferedOutput();

        $app->run($input, $output);

        return $output->fetch();
    }
}

--- 
+++ 
@@ -21,4 +21,18 @@
 
         return $output->fetch();
     }
+
+    protected function assertHasApc()
+    {
+        if (!extension_loaded('apc')) {
+            $this->markTestSkipped('APC extension is not loaded.');
+        }
+    }
+
+    protected function assertHasOpcache()
+    {
+        if (!extension_loaded('Zend OPcache')) {
+            $this->markTestSkipped('OPcache extension is not loaded.');
+        }
+    }
 }
Add assert extension functions to command test
