/** * @test */ public function flushRemovesOnlyOwnEntries() { $backendOptions = ['servers' => ['localhost:11211']]; $thisCache = $this->getMockBuilder(AbstractFrontend::class)->disableOriginalConstructor()->getMock(); $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache')); $thisBackend = new MemcachedBackend($this->getEnvironmentConfiguration(), $backendOptions); $thisBackend->setCache($thisCache); $thatCache = $this->getMockBuilder(AbstractFrontend::class)->disableOriginalConstructor()->getMock(); $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache')); $thatBackend = new MemcachedBackend($this->getEnvironmentConfiguration(), $backendOptions); $thatBackend->setCache($thatCache); $thisBackend->set('thisEntry', 'Hello'); $thatBackend->set('thatEntry', 'World!'); $thatBackend->flush(); $this->assertEquals('Hello', $thisBackend->get('thisEntry')); $this->assertFalse($thatBackend->has('thatEntry')); }