public function testLoadEventIsTriggered() { $this->idGeneratorMock->shouldReceive('generate')->andReturn('foo-bar'); $self = $this; $this->cacheService->getEventManager()->attach(CacheEvent::EVENT_LOAD, function ($e) use($self) { $self->assertInstanceOf('StrokerCache\\Event\\CacheEvent', $e); $self->assertEquals('foo-bar', $e->getCacheKey()); }); $this->storageMock->shouldReceive('hasItem')->andReturn(true); $this->cacheService->load(); }