public function testRemove() { list($storage, $repo, $reader, $temp) = $this->getMocks(); $instance = new AudioHandler($storage, $repo, $reader, $temp); $mockMeta = m::mock('Xpressengine\\Media\\Meta'); $mockMedia = m::mock('Xpressengine\\Media\\Spec\\Media'); $mockMedia->shouldReceive('getMeta')->andReturn($mockMeta); $repo->shouldReceive('delete')->once()->with($mockMeta); $instance->remove($mockMedia); }
public function testMakeThrownExceptionWhenNotAvailable() { list($storage, $reader, $temp) = $this->getMocks(); $instance = new AudioHandler($storage, $reader, $temp); $mockFile = m::mock('Xpressengine\\Storage\\File'); $mockFile->shouldReceive('getAttribute')->with('mime')->andReturn('image/jpeg'); try { $instance->make($mockFile); $this->assertTrue(false); } catch (\Exception $e) { $this->assertInstanceOf('Xpressengine\\Media\\Exceptions\\NotAvailableException', $e); } }