<?php
/**
* Moc10 Library
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.TXT.
* It is also available through the world-wide-web at this URL:
* http://www.moc10phplibrary.com/LICENSE.TXT
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to hide@address.com so we can send you a copy immediately.
*
* @category Moc10
* @package Moc10_Curl
* @author Nick Sagona, III <hide@address.com>
* @copyright Copyright (c) 2009-2011 Moc 10 Media, LLC. (http://www.moc10media.com)
* @license http://www.moc10phplibrary.com/LICENSE.TXT New BSD License
*/
require_once dirname(__FILE__) . '/../../library/Moc10/Autoloader.php';
Moc10_Autoloader::bootstrap();
class Moc10_CurlTest extends PHPUnit_Framework_TestCase
{
public function testCurlConstructor()
{
$c = new Moc10_Curl(array(CURLOPT_URL => 'http://www.moc10phplibrary.com/LICENSE.TXT'));
$class = 'Moc10_Curl';
$this->assertTrue($c instanceof $class);
}
public function testCurlSetAndGetOption()
{
$c = new Moc10_Curl(array(CURLOPT_URL => 'http://www.moc10phplibrary.com/LICENSE.TXT'));
$c->setOption(CURLOPT_HEADER, FALSE);
$this->assertEquals(FALSE, $c->getOption(CURLOPT_HEADER));
}
public function testCurlExecute()
{
$opts = array(CURLOPT_URL => 'http://www.moc10phplibrary.com/LICENSE.TXT',
CURLOPT_HEADER => FALSE,
CURLOPT_RETURNTRANSFER => TRUE);
$c = new Moc10_Curl($opts);
$output = $c->execute();
$this->assertEquals(1654, strlen($output));
}
}
?>