Skip to content

Commit

Permalink
Add BlobStore::getStats
Browse files Browse the repository at this point in the history
  • Loading branch information
mwjames committed May 29, 2015
1 parent df86219 commit 9175bb2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/BlobStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ public function exists( $id ) {
return $this->cache->contains( $this->getKey( $id ) );
}

/**
* @since 1.0
*
* @return array
*/
public function getStats() {
return $this->cache->getStats();
}

/**
* @since 1.0
*
Expand Down
6 changes: 3 additions & 3 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
ini_set( 'display_errors', 1 );

if ( is_readable( $path = __DIR__ . '/../vendor/autoload.php' ) ) {
print( "\nUsing the local vendor autoloader ...\n\n" );
} elseif ( is_readable( $path = __DIR__ . '/../../../vendor/autoload.php' ) ) {
print( "\nUsing the MediaWiki vendor autoloader ...\n\n" );
print( "\nUsing the blobstore vendor autoloader ...\n\n" );
} elseif ( is_readable( $path = __DIR__ . '/../../../autoload.php' ) ) {
print( "\nUsing another local vendor autoloader ...\n\n" );
} else {
die( 'The test suite requires a Composer based deployement.' );
}
Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/Unit/BlobStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ public function testReadContainerForKnownIdToAlwaysReturnArrayType() {
);
}

public function testGetStats() {

$this->cache->expects( $this->once() )
->method( 'getStats' );

$instance = new BlobStore( 'Foo', $this->cache );
$instance->getStats();
}

public function testSaveContainer() {

$container = array( 'Foobar', new \stdClass, array() );
Expand Down

0 comments on commit 9175bb2

Please sign in to comment.