/** * @expectedException PHPUnit_Framework_Error_Warning */ public function testDestroyWithException() { $key = new Key('projectid'); $key->pathElement(self::KIND, 'sessionid'); $this->transaction->delete($key)->shouldBeCalledTimes(1); $this->transaction->commit()->shouldBeCalledTimes(1)->willThrow(new Exception()); $this->datastore->transaction()->shouldBeCalledTimes(1)->willReturn($this->transaction->reveal()); $this->datastore->key(self::KIND, 'sessionid', ['namespaceId' => self::NAMESPACE_ID])->shouldBeCalledTimes(1)->willReturn($key); $datastoreSessionHandler = new DatastoreSessionHandler($this->datastore->reveal()); $datastoreSessionHandler->open(self::NAMESPACE_ID, self::KIND); $ret = $datastoreSessionHandler->destroy('sessionid'); $this->assertEquals(false, $ret); }