public function testTorrentGetShouldThrowAnExceptionWithAnInvalidSessionId() { $fields = ['creator', 'totalSize']; $requestBody = '{"method":"torrent-get","arguments":{"ids":[42,1337],"fields":["creator","totalSize"]}}'; $invalidSessionId = uniqid(); $this->sendRequest($requestBody, $invalidSessionId)->andThrow($this->generateCSRFException()); try { $this->rpcClient->torrentGet($invalidSessionId, self::TORRENT_IDS, $fields); } catch (CSRFException $e) { $this->assertSame($this->sessionId, $e->getSessionId()); } }