Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Skip APC storage test if apcu extension is not enabled (as Travis won…
Browse files Browse the repository at this point in the history
…'t cooperate)
  • Loading branch information
Michael Wikberg authored and mcoirault committed Feb 4, 2021
1 parent 6c7a01b commit ecc416f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/StorageAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class StorageAdapterFactory
* @param array $config
*
* @return Adapter
*
* @throws \Prometheus\Exception\StorageException
*/
public function make($driver, array $config = [])
{
Expand Down
8 changes: 7 additions & 1 deletion tests/StorageAdapterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests;

use PHPUnit\Framework\TestCase;
use Prometheus\Exception\StorageException;
use Prometheus\Storage\APC;
use Prometheus\Storage\InMemory;
use Prometheus\Storage\Redis;
Expand All @@ -20,7 +21,12 @@ public function testMakeMemoryAdapter()
public function testMakeApcAdapter()
{
$factory = new StorageAdapterFactory();
$adapter = $factory->make('apc');
try {
$adapter = $factory->make('apc');
} catch (StorageException $exception) {
$this->markTestSkipped("APCu not enabled? Skipping test");
return;
}
$this->assertInstanceOf(APC::class, $adapter);
}

Expand Down

0 comments on commit ecc416f

Please sign in to comment.