watch() public method

Executes WATCH against one or more keys.
public watch ( string | array $keys ) : mixed
$keys string | array One or more keys.
return mixed
コード例 #1
0
 /**
  * @group disconnected
  * @expectedException \Predis\NotSupportedException
  * @expectedExceptionMessage WATCH is not supported by the current profile.
  */
 public function testThrowsExceptionOnUnsupportedWatchInProfile()
 {
     $profile = $this->getMock('Predis\\Profile\\ProfileInterface');
     $profile->expects($this->once())->method('supportsCommands')->with(array('MULTI', 'EXEC', 'DISCARD'))->will($this->returnValue(true));
     $profile->expects($this->once())->method('supportsCommand')->with('WATCH')->will($this->returnValue(false));
     $connection = $this->getMock('Predis\\Connection\\NodeConnectionInterface');
     $client = new Client($connection, array('profile' => $profile));
     $tx = new MultiExec($client, array('options' => 'cas'));
     $tx->watch('foo');
 }