/** * @group disconnected * @expectedException Predis\NotSupportedException * @expectedExceptionMessage The current profile does not support WATCH and UNWATCH */ public function testThrowsExceptionOnUnsupportedWatchUnwatchInProfile() { $connection = $this->getMock('Predis\\Connection\\SingleConnectionInterface'); $client = new Client($connection, array('profile' => '2.0')); $tx = new MultiExecContext($client, array('options' => 'cas')); $tx->watch('foo'); }
/** * @group disconnected * @expectedException Predis\NotSupportedException * @expectedExceptionMessage The current profile does not support WATCH and UNWATCH */ public function testThrowsExceptionOnUnsupportedWatchUnwatchInProfile() { $profile = $this->getMock('Predis\\Profile\\ServerProfileInterface'); $profile->expects($this->at(0))->method('supportsCommands')->with(array('MULTI', 'EXEC', 'DISCARD'))->will($this->returnValue(true)); $profile->expects($this->at(1))->method('supportsCommands')->with(array('WATCH', 'UNWATCH'))->will($this->returnValue(false)); $connection = $this->getMock('Predis\\Connection\\SingleConnectionInterface'); $client = new Client($connection, array('profile' => $profile)); $tx = new MultiExecContext($client, array('options' => 'cas')); $tx->watch('foo'); }