mime 별 파일 용량 정보 반환
public bytesByMime ( callable $scope = null ) : array | ||
$scope | callable | 검색 조건 |
Résultat | array | ex.) [mime => bytes] |
public function testBytesByMime() { list($handler, $repo, $auth, $keygen) = $this->getMocks(); $instance = new Storage($handler, $repo, $auth, $keygen); $repo->shouldReceive('sumGroupBy')->twice()->andReturn(['image/jpeg' => 15116107, 'image/gif' => 14008053]); $data = $instance->bytesByMime([], false); $this->assertEquals(15116107 + 14008053, array_sum($data)); $data = $instance->bytesByMime(); $this->assertEquals(15116107, reset($data)); $this->assertEquals(14008053, next($data)); }