Source for file Bug7406.php
Documentation is available at Bug7406.php
// +----------------------------------------------------------------------+
// | MakeTorrent and Encode data in Bittorrent format |
// +----------------------------------------------------------------------+
// | Copyright (C) 2004-2005 Markus Tacker <m@tacker.org> |
// +----------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the |
// | Free Software Foundation, Inc. |
// | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
// +----------------------------------------------------------------------+
* @link http://pear.php.net/bugs/bug.php?id=7406
* @package File_Bittorrent
* @author Markus Tacker <m@tacker.org>
* @version $Id: Bug7406.php 72 2007-03-13 14:53:28Z m $
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'File/Bittorrent/MakeTorrent.php';
require_once 'File/Bittorrent/Decode.php';
* @link http://pear.php.net/bugs/bug.php?id=7406
* @package File_Bittorrent
* @author Markus Tacker <m@tacker.org>
* @version $Id: Bug7406.php 72 2007-03-13 14:53:28Z m $
public static $torrent = './bugs/bug-7406/TestDir';
$MakeTorrent->setAnnounce ('http://www.example.org');
$MakeTorrent->setComment ('Hello World!');
// Set the piece length (in KB)
$MakeTorrent->setPieceLength (256 );
$metainfo = $MakeTorrent->buildTorrent ();
$Decode = new File_Bittorrent_Decode ();
$info = $Decode->decode ($metainfo);
$this->assertEquals (count($info['info']['files']), 3 );
foreach ($info['info']['files'] as $k => $v) {
$files[] = $v['path'][0 ];
$this->assertEquals ($expected, $files);
Documentation generated on Tue, 13 Mar 2007 10:00:09 -0500 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.
|