Example #1
0
 private function addFile(InputInterface $input, OutputInterface $output, TransmissionClient $client, $torrentFile)
 {
     $this->dryRun($input, $output, function () use($torrentFile, $client, $input, $output) {
         $torrentAdded = $client->addTorrent($torrentFile);
         if ($torrentAdded) {
             if (isset($torrentAdded['duplicate'])) {
                 $output->writeln($torrentFile . ' was not added. Probably it was added before.');
             } else {
                 $output->writeln($torrentFile . ' added. Waiting for Transmission...');
                 $client->waitForTransmission(10);
             }
         }
     }, 'dry-run, don\'t really add torrents');
 }
 public function testGetFreeSpaceWithDir()
 {
     $this->api = $this->getMock('Martial\\Transmission\\API\\RpcClient', ['sessionGet', 'getSessionId', 'freeSpace'], [$this->httpClient, '', '']);
     $this->api->method('sessionGet')->willReturn([Session\Get::DOWNLOAD_DIR => '/a/b/c']);
     $this->client = new TransmissionClient($this->api);
     $this->api->expects($this->once())->method('freeSpace')->with(null, '/d/e/f')->willReturn(['size-bytes' => 12345]);
     $this->assertEquals(12345, $this->client->getFreeSpace('/d/e/f'));
 }