function setUp()
    {
        global $DEBUG, $LOCALSERVER;
        $this->client = new xmlrpc_client('/NOTEXIST.php', $LOCALSERVER, 80);
        if ($DEBUG) {
            $this->client->setDebug(1);
        }
    }
    function test404()
    {
        $f = new xmlrpcmsg('examples.echo', array(new xmlrpcval('hello', 'string')));
        $r = $this->client->send($f);
        $this->assertEquals(5, $r->faultCode());
    }
}
$suite->addTest(new LocalhostTests('testString'));
$suite->addTest(new LocalhostTests('testAdding'));
$suite->addTest(new LocalhostTests('testAddingDoubles'));
$suite->addTest(new LocalhostTests('testInvalidNumber'));
$suite->addTest(new LocalhostTests('testBoolean'));
$suite->addTest(new LocalhostTests('testCountEntities'));
$suite->addTest(new LocalhostTests('testBase64'));
$suite->addTest(new LocalhostTests('testServerMulticall'));
$suite->addTest(new LocalhostTests('testClientMulticall1'));
$suite->addTest(new LocalhostTests('testClientMulticall2'));
$suite->addTest(new LocalhostTests('testClientMulticall3'));
$suite->addTest(new LocalhostTests('testCatchWarnings'));
$suite->addTest(new LocalhostTests('testZeroParams'));
$suite->addTest(new LocalhostTests('testCodeInjectionServerSide'));
$suite->addTest(new LocalhostTests('testAutoRegisteredFunction'));
$suite->addTest(new LocalhostTests('testAutoRegisteredMethod'));
        $user = new User();
        $user->first_name = 'Gaurav';
        $user->last_name = 'Bhatnagar';
        $user->homepage = 'http://www.newdelhitimes.org';
        $user->login_name = 'gaurav';
        $user->password = md5('password1');
        $user->email = '*****@*****.**';
        $user->save();
      }
      else {
        throw $e;
      }
    }

    $newuser = new User();
    $newuser->load('gaurav');
    $this->assertTrue($newuser->first_name == 'Gaurav');
    $newuser->delete();
    $this->assertTrue($newuser->is_active == FALSE);
  }
}

$suite = new PHPUnit_TestSuite();
$suite->addTest(new UserTestCase('testUserCRUD'));
$result = new PHPUnit_TestResult();
$suite->run($result);

print($result->toString());

?>
Exemplo n.º 3
0
<?php

/**
 * Unit tests for Event_Dispatcher class
 * 
 * $Id: test.php,v 1.1.1.1 2005/11/29 19:21:53 sjhannah Exp $
 *
 * @package    Event_Dispatcher
 * @subpackage Tests
 */
require_once 'System.php';
require_once 'PHPUnit.php';
require_once 'Event/Dispatcher.php';
$testcases = array('Dispatcher_testcase');
$suite = new PHPUnit_TestSuite();
foreach ($testcases as $testcase) {
    include_once $testcase . '.php';
    $methods = preg_grep('/^test/i', get_class_methods($testcase));
    foreach ($methods as $method) {
        $suite->addTest(new $testcase($method));
    }
}
require_once './Console_TestListener.php';
$result = new PHPUnit_TestResult();
$result->addListener(new Console_TestListener());
$suite->run($result);
Exemplo n.º 4
0
include 'FileContainer.php';
include 'DBContainer.php';
include 'MDBContainer.php';
include 'POP3Container.php';
include 'POP3aContainer.php';
include 'IMAPContainer.php';
include_once 'PHPUnit.php';
function error($err)
{
    print "Error\n";
    print "Code:" . trim($err->getCode()) . "\n";
    print "Message:" . trim($err->getMessage()) . "\n";
    #print "UserInfo:".trim($err->getUserInfo())."\n";
    #print "DebugInfo:".trim($err->getDebugInfo())."\n";
}
#error_reporting(0);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT, "\nPear Error:%s \n");
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "error");
set_time_limit(0);
$suite = new PHPUnit_TestSuite();
// File Container
$suite->addTest(new PHPUnit_TestSuite('IMAPContaner'));
$suite->addTest(new PHPUnit_TestSuite('FileContaner'));
// DB Container
//$suite->addTest(new PHPUnit_TestSuite('DBContainer'));
// MDB Container
//$suite->addTest(new PHPUnit_TestSuite('MDBContainer'));
// POP3 Container
//$suite->addTest(new PHPUnit_TestSuite('POP3Container'));
$result = PHPUnit::run($suite);
echo $result->toString();
Exemplo n.º 5
0
include_once 'MDB2Container.php';
include_once 'POP3Container.php';
include_once 'POP3aContainer.php';
include_once 'IMAPContainer.php';
include_once 'PHPUnit.php';
function error($err)
{
    print "Error\n";
    print "Code:" . trim($err->getCode()) . "\n";
    print "Message:" . trim($err->getMessage()) . "\n";
    #print "UserInfo:".trim($err->getUserInfo())."\n";
    #print "DebugInfo:".trim($err->getDebugInfo())."\n";
}
#error_reporting(0);
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "\nPear Error:%s \n");
#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "error");
set_time_limit(0);
$suite = new PHPUnit_TestSuite();
// File Container
#$suite->addTest(new PHPUnit_TestSuite('IMAPContainer'));
$suite->addTest(new PHPUnit_TestSuite('FileContainer'));
$suite->addTest(new PHPUnit_TestSuite('DBContainer'));
//$suite->addTest(new PHPUnit_TestSuite('DBLiteContainer'));
// MDB Container
$suite->addTest(new PHPUnit_TestSuite('MDBContainer'));
// MDB2 Container
$suite->addTest(new PHPUnit_TestSuite('MDB2Container'));
// POP3 Container
$suite->addTest(new PHPUnit_TestSuite('POP3Container'));
$result = PHPUnit::run($suite);
echo $result->toString();
Exemplo n.º 6
0
// +-----------------------------------------------------------------------------+
// | Copyright (c) 2003 Sérgio Gonçalves Carvalho                                |
// +-----------------------------------------------------------------------------+
// | This file is part of Structures_Graph.                                      |
// |                                                                             |
// | Structures_Graph 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.                                         |
// |                                                                             |
// | Structures_Graph 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 Structures_Graph; if not, write to the Free Software             |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
// | 02111-1307 USA                                                              |
// +-----------------------------------------------------------------------------+
// | Author: Sérgio Carvalho <*****@*****.**>                  |
// +-----------------------------------------------------------------------------+
//
// Place development Structures_Graph ahead in the include_path
ini_set('include_path', realpath(dirname(__FILE__) . "/..") . ":.:" . ini_get('include_path'));
require_once 'testCase/BasicGraph.php';
require_once 'PHPUnit.php';
$suite = new PHPUnit_TestSuite();
$suite->addTest(new PHPUnit_TestSuite('BasicGraph'));
$result = PHPUnit::run($suite);
echo $result->toString();
Exemplo n.º 7
0
        $this->_checkUseNonce($store, $nonce1, true, 2);
        $this->_checkUseNonce($store, $nonce1, false, 3);
        $this->_checkUseNonce($store, $nonce1, false, 4);
        // Storing twice has the same effect as storing once.
        $store->storeNonce($nonce1);
        $store->storeNonce($nonce1);
        $this->_checkUseNonce($store, $nonce1, true, 5);
        $this->_checkUseNonce($store, $nonce1, false, 6);
        $this->_checkUseNonce($store, $nonce1, false, 7);
        // Auth key functions
        // There is no key to start with, so generate a new key and
        // return it.
        $key = $store->getAuthKey();
        // The second time around should return the same as last time.
        $key2 = $store->getAuthKey();
        $this->assertEquals($key, $key2, "Auth keys differ");
        $this->assertEquals(strlen($key), $store->AUTH_KEY_LEN, "Key length not equals AUTH_KEY_LEN");
    }
    function testMemcStore()
    {
        # Unique prefix for this test
        $prefix = sprintf("test-%x", time());
        $store = new OpenID_MemcStore($prefix);
        $this->_testStore($store);
        $this->_testNonce($store);
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTest(new Tests_OpenID_MemcStore('testMemcStore'));
$result = PHPUnit::run($suite);
print $result->toString();