/**
  * Testing .torrent file creation.
  *
  * @return void
  */
 public function testCreateTorrentFile()
 {
     $bencoded_torrent = (string) $this->object->createTorrentFile();
     $parser = new Bencode\Parser($bencoded_torrent);
     $decoded_torrent = $parser->parse()->represent();
     $this->assertEquals($decoded_torrent['info']['piece length'], $this->object->size_piece);
     $this->assertEquals($decoded_torrent['info']['name'], $this->object->name);
     $this->assertEquals($decoded_torrent['info']['length'], $this->object->length);
     $this->assertEquals($decoded_torrent['info']['pieces'], $this->object->pieces);
     $this->assertEquals($decoded_torrent['info']['private'], $this->object->private);
     $this->assertEquals($decoded_torrent['announce'], 'http://announce');
     $this->assertContains(array('http://announce'), $decoded_torrent['announce-list']);
     $this->assertEquals($decoded_torrent['url-list'], array('http://example.com/test.ext'));
 }
 /**
  * Parse a torrent (Bencode decode)
  *
  * @param string $torrent Torrent
  *
  * @return mixed
  * @throws Bencode\Error\Parse
  */
 protected function parseTorrent($torrent)
 {
     $parser = new Bencode\Parser($torrent);
     return $parser->parse()->represent();
 }
 /**
  * Parse the response (Bencode decode)
  *
  * @param string $response The response string
  *
  * @return mixed
  * @throws Bencode\Error\Parse
  */
 protected function parseResponse($response)
 {
     $parser = new Bencode\Parser($response);
     return $parser->parse()->represent();
 }