public function testSessionSetShouldThrowAnExceptionWithAnInvalidSessionId() { $downloadDir = '/path/to/download-dir'; $peerLimitGlobal = 42; $invalidSessionId = uniqid(); $sessionArgs = ['download-dir' => $downloadDir, 'peer-limit-global' => $peerLimitGlobal]; $requestBody = sprintf('{"method":"session-set","arguments":{"download-dir":"%s","peer-limit-global":%d}}', $downloadDir, $peerLimitGlobal); $this->sendRequest($requestBody, $invalidSessionId)->andThrow($this->generateCSRFException()); try { $this->rpcClient->sessionSet($invalidSessionId, $sessionArgs); } catch (CSRFException $e) { $this->assertSame($this->sessionId, $e->getSessionId()); } }