当前位置: 首页>>代码示例>>PHP>>正文


PHP TestSuite::AddTest方法代码示例

本文整理汇总了PHP中TestSuite::AddTest方法的典型用法代码示例。如果您正苦于以下问题:PHP TestSuite::AddTest方法的具体用法?PHP TestSuite::AddTest怎么用?PHP TestSuite::AddTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestSuite的用法示例。


在下文中一共展示了TestSuite::AddTest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Run

<?php

include_once './framework/doctrinetestcase.php';
class StoreServiceTest extends DoctrineTestCase
{
    public function Run()
    {
        include_once '../InitData.ini.php';
        $typeAndRate = array();
        foreach ($PowerupTypes as $value) {
            $typeAndRate[$value[0]] = $value[3];
        }
        $amount = 1;
        $typeCollection = Utility\CommonUtility::GetRandomPowerUpsType($typeAndRate, $amount);
        $this->AssertEquals(count($typeCollection), $amount, "get random {$amount} powerup failed");
        $amount = 5;
        $typeCollection = Utility\CommonUtility::GetRandomPowerUpsType($typeAndRate, $amount);
        $this->AssertEquals(count($typeCollection), $amount, "get random {$amount} powerup failed");
        $amount = 11;
        $typeCollection = Utility\CommonUtility::GetRandomPowerUpsType($typeAndRate, $amount);
        $this->AssertEquals(count($typeCollection), $amount, "get random {$amount} powerup failed");
    }
}
$suite = new TestSuite();
$suite->AddTest('StoreServiceTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:27,代码来源:StoreServiceTest.php

示例2: SetUp

<?php

require_once '../odmconfig.php';
include_once './framework/php_unit_test.php';
require_once './framework/xhtml_test_runner.php';
require_once './framework/text_test_runner.php';
require_once './framework/xml_test_runner.php';
require_once './framework/console_test_runner.php';
class GearmanTest extends TestCase
{
    public function SetUp()
    {
    }
    public function TearDown()
    {
    }
    public function Run()
    {
        /* create our object */
        $gmclient = new \GearmanClient();
        /* add the default server */
        $gmclient->addServer();
        /* run reverse client */
        $job_handle = $gmclient->doBackground("reverse", "this is a test");
    }
}
$suite = new TestSuite();
$suite->AddTest('GearmanTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:30,代码来源:gearman_ut.php

示例3: SetUp

include_once './framework/doctrinetestcase.php';
class UserTest extends DoctrineTestCase
{
    private $m = NULL;
    private $db;
    private $users;
    public function SetUp()
    {
        $this->m = new \Mongo();
        $this->db = $this->m->bingo;
        $this->users = $this->db->User;
        $this->users->drop();
    }
    public function Run()
    {
        $user = new Models\User();
        $user->name = 'winston';
        $this->doctrinemodel->persist($user);
        $this->doctrinemodel->flush();
        $userfind = $this->doctrinemodel->createQueryBuilder('Models\\User')->field('name')->equals('winston')->getQuery()->getSingleResult();
        $this->AssertEquals($userfind->name, 'winston', 'User name not equal');
    }
    public function TearDown()
    {
        $this->users->drop();
    }
}
$suite = new TestSuite();
$suite->AddTest('UserTest');
$runner = new TextTestRunner();
$runner->Run($suite);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:user_ut.php

示例4: TestSuite

        $this->AssertEquals($result, TRUE, 'publish message failed');
        $msgbody3 = 'hello player3';
        // Publish a message to the exchange with a routing key
        $result = $ex->publish($msgbody3, 'queue3.command');
        $this->AssertEquals($result, TRUE, 'publish message failed');
        // Read from the queue
        $msg = $q1->consume($options);
        $this->AddMessage(var_export($msg, true));
        $this->AssertEquals(count($msg), 2);
        $this->AssertEquals($msg[0]['message_body'], $msgbody1, 'message not equal');
        $this->AssertEquals($msg[1]['message_body'], $msgbody2, 'message not equal');
        // Read from the queue
        $msg = $q2->consume($options);
        $this->AssertEquals(count($msg), 2);
        $this->AssertEquals($msg[0]['message_body'], $msgbody1, 'message not equal');
        $this->AssertEquals($msg[1]['message_body'], $msgbody2, 'message not equal');
        // Read from the queue
        $msg = $q3->consume($options);
        $this->AddMessage(var_export($msg, true));
        $this->AssertEquals(count($msg), 3);
        $this->AssertEquals($msg[0]['message_body'], $msgbody1, 'message not equal');
        $this->AssertEquals($msg[1]['message_body'], $msgbody2, 'message not equal');
        $this->AssertEquals($msg[2]['message_body'], $msgbody3, 'message not equal');
        $msg = $q3->consume($options);
        $this->AssertEquals(count($msg), 0);
    }
}
$suite = new TestSuite();
$suite->AddTest('AMQPTopicTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:amqp_topic_ut.php

示例5: TearDown

        $register = $login->Register($this->AddQuote($username)
        							, $this->AddQuote($pwd) 
        							, $this->AddQuote('LyleXu@gmail.com')
        							, $this->AddQuote($registerNonce->_sessionId)
        							, $this->AddQuote($registerNonce->_nonce));
        
        $this->AssertEquals($register->_returnCode, Constant\ErrorCode::OK, 'Register not successfully');
        
        
        
        $nonce = $login->GetNonce($this->AddQuote($username));
        	    $this->AssertEquals(strlen($nonce->_nonce), 6, 'Login not successfully');	
        	    
        $cnonce = "abcdef";
        
        $pwdfromclient = md5($nonce->_nonce.$cnonce.$decrypt);
        
        $result = $login->Login($username,$pwdfromclient,$cnonce);
        $this->AssertEquals($result->_returnCode, Constant\ErrorCode::OK, 'Login not successfully');		
        */
    }
    public function TearDown()
    {
        //$this->users->drop();
    }
}
$suite = new TestSuite();
$suite->AddTest('LoginServiceTest');
$runner = new ConsoleTestRunner();
//$runner = new TextTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:Login_ut.php

示例6: Run

{
    public function Run()
    {
        $a = new \Models\A();
        $this->doctrinemodel->persist($a);
        $this->doctrinemodel->flush();
        $this->AddMessage(gettype($a->getDoccol()));
        $this->AddMessage(gettype($a->getNatcol()));
        $this->AddMessage(gettype($a->getBs()));
        $a->addDoccol(1);
        $a->mergeDoccol(array(2, 3));
        //array_push($a->getNatcol(), 1);
        $this->doctrinemodel->flush();
    }
}
class DoctrineTestIncrement extends DoctrineTestCase
{
    public function Run()
    {
        for ($i = 1; $i < 100; $i++) {
            $c = new \Models\C();
            $c->value = str_repeat($i, 10);
            $this->doctrinemodel->persist($c);
        }
        $this->doctrinemodel->flush();
    }
}
$suite = new TestSuite();
$suite->AddTest('DoctrineTestIncrement');
$runner = new TextTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:doctrine_ut.php

示例7: SetUp

<?php

require_once '../odmconfig.php';
include_once './framework/php_unit_test.php';
require_once './framework/xhtml_test_runner.php';
require_once './framework/text_test_runner.php';
require_once './framework/xml_test_runner.php';
require_once './framework/console_test_runner.php';
class MemcacheTest extends TestCase
{
    public function SetUp()
    {
    }
    public function TearDown()
    {
    }
    public function Run()
    {
        $memcache = new \Memcache();
        $this->AssertEquals($memcache->connect('localhost', 11211), TRUE, 'connect');
        $memcache->set('testkey', 'testvalue', MEMCACHE_COMPRESSED);
        $this->AssertEquals($memcache->get('testkey'), 'testvalue');
    }
}
$suite = new TestSuite();
$suite->AddTest('MemcacheTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:28,代码来源:memcache_ut.php

示例8: TestSuite

        $this->AssertEquals($gamecard->daubAll($userDaubNumbers), \Constant\ErrorCode::OK, 'Daub all failed');
        $this->doctrinemodel->flush();
        $this->AssertEquals($gamecard->evaluateResult(range(1, 75)), \Constant\GameResult::Failed, 'evaluateResult not win');
        // add the instant win number
        array_push($gamecard->autoDaubNumberList, $singleDaubNumber);
        $this->AssertEquals($gamecard->evaluateResult(range(1, 75)), \Constant\GameResult::Win, 'evaluateResult not win');
        // check the second gameboard for double daub
        $secondGameCard = $newGameRound->getCardForUser($user, 1);
        $newUserCard = $secondGameCard->getUserCard();
        $newGameRound->currentCallNumberIndex = 75;
        $userDaubNumbers = $newUserCard[0];
        $firstDaubNumber = $userDaubNumbers[count($userDaubNumbers) - 1];
        $secondDaubNumber = $userDaubNumbers[count($userDaubNumbers) - 2];
        array_pop($userDaubNumbers);
        // remove the last number
        array_pop($userDaubNumbers);
        $this->AssertEquals($secondGameCard->daubAll($userDaubNumbers), \Constant\ErrorCode::OK, 'Daub all failed');
        $this->doctrinemodel->flush();
        $this->AssertEquals($secondGameCard->evaluateResult(range(1, 75)), \Constant\GameResult::Failed, 'evaluateResult not win');
        array_push($secondGameCard->autoDaubNumberList, $firstDaubNumber);
        array_push($secondGameCard->secondDaubNumberList, $secondDaubNumber);
        $this->AssertEquals($secondGameCard->evaluateResult(range(1, 75)), \Constant\GameResult::Win, 'evaluateResult not win');
    }
}
$suite = new TestSuite();
$suite->AddTest('GameCardStaticTest');
$suite->AddTest('GameCardGeneraterTest');
$suite->AddTest('GameCardInstantWinTest');
$suite->AddTest('GameCardSinagleDauborDoubleDaubTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:gamecard_ut.php

示例9: SetUp

include_once './framework/doctrinetestcase.php';
include_once '../amfphp/services/VersionService.php';
include_once '../lib/Constant/ErrorCode.php';
class VersionServiceTest extends DoctrineTestCase
{
    public function SetUp()
    {
    }
    public function Run()
    {
        $version = new VersionService();
        $platform = 'iPad';
        $currentVersion = '0.9';
        $result = $version->NeedUpdate($this->AddQuote($platform), $this->AddQuote($currentVersion));
        $this->AssertEquals($result->_returnCode, Constant\ErrorCode::VersionNeedUpdate, 'Need update');
        $platform = 'iPad';
        $currentVersion = '1.2';
        $result = $version->NeedUpdate($this->AddQuote($platform), $this->AddQuote($currentVersion));
        $this->AssertEquals($result->_returnCode, Constant\ErrorCode::OK, 'No Need update');
        $platform = 'abc';
        $result = $version->NeedUpdate($this->AddQuote($platform), $this->AddQuote($currentVersion));
        $this->AssertEquals($result->_returnCode, Constant\ErrorCode::VersionUnkownPlatform, 'Unkown platform');
    }
    public function TearDown()
    {
    }
}
$suite = new TestSuite();
$suite->AddTest('VersionServiceTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:Version_ut.php

示例10: TearDown

        $this->doctrinemodel->flush();
        $gameRound->Initialize();
        $userboards = $gameRound->getUserBoards();
        $callnumbers = $gameRound->getCallNumber();
        $this->AssertEquals(count($callnumbers), 10, 'call number equal 10');
        $this->AssertEquals(count($userboards), 1, 'user boards equal 1');
        $this->AssertEquals(count($userboards[$user->id]), 25, 'userboard size equal 25');
        $gameRound2 = new Models\GameRound($gameRoom, 11, 25);
        $this->doctrinemodel->persist($gameRound2);
        $this->doctrinemodel->flush();
        $gameRound2->Initialize();
        // Join game for user2
        $this->AssertEquals($gameRoom->ConnectUser($user2), TRUE, 'Call ConnectUser for user2');
        $userboards = $gameRound2->getUserBoards();
        $callnumbers = $gameRound2->getCallNumber();
        $this->AssertEquals(count($callnumbers), 11, 'call number equal 11');
        $this->AssertEquals(count($userboards), 1, 'user boards equal 1');
        $this->AssertEquals(count($userboards[$user->id]), 25, 'user2 userboard size equal 25');
        $this->AssertEquals(count($userboards[$user2->id]), 25, 'user2 userboard size equal 25');
    }
    public function TearDown()
    {
        $this->gameroom->drop();
        $this->users->drop();
        $this->gameround->drop();
    }
}
$suite = new TestSuite();
$suite->AddTest('GameRoundTest');
$runner = new TextTestRunner();
$runner->Run($suite, true);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:gameround_ut.php

示例11: AMQPExchange

    {
        // Declare a new exchange
        $ex = new AMQPExchange($this->cnn);
        $ex->declare('game', AMQP_EX_TYPE_FANOUT);
        // Create a new queue
        $q1 = new AMQPQueue($this->cnn);
        $q1->declare('queue1');
        $q2 = new AMQPQueue($this->cnn);
        $q2->declare('queue2');
        // Bind it on the exchange to routing.key
        //$ex->bind('queue1', 'broadcast=true,target=queue1,x-match=any');
        $ex->bind('queue1', '');
        $ex->bind('queue2', '');
        $msgBody = 'hello';
        // Publish a message to the exchange with a routing key
        $ex->publish($msgBody, 'foo');
        // Read from the queue
        $msg = $q1->consume();
        $this->AssertEquals(count($msg), 1);
        $this->AssertEquals($msg[0]['message_body'], $msgBody, 'message not equal');
        // Read from the queue
        $msg = $q2->consume();
        $this->AssertEquals(count($msg), 1);
        $this->AssertEquals($msg[0]['message_body'], $msgBody, 'message not equal');
        $this->AddMessage(var_export($msg[0], true));
    }
}
$suite = new TestSuite();
$suite->AddTest('AMQPDirectExOneQueueTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:amqp_ut.php

示例12: Run

        $this->GCCollectCycle();
        $this->PrintMemoryOverview();
    }
}
class DoctrineMemoryLeakTest extends MemoryLeakBaseTestCase
{
    public function Run()
    {
        ob_implicit_flush(TRUE);
        for ($i = 0; $i < 10; $i++) {
            $this->PrintMemoryOverview();
            $users = $this->doctrinemodel->getRepository('Models\\User')->findAll();
            foreach ($users as $user) {
                echo 'Found User: ' . $user->name . PHP_EOL;
                //$this->doctrinemodel->detach($user);
                //unset($user);
            }
            //unset($users);
            //$this->doctrinemodel->clear();
            //$this->doctrinemodel->close();
            $this->GCCollectCycle();
            $this->PrintMemoryOverview();
            //sleep(1);
        }
    }
}
$suite = new TestSuite();
//$suite->AddTest('NormalMemoryLeakTest');
$suite->AddTest('DoctrineMemoryLeakTest');
$runner = new ConsoleTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:MemoryLeak.php

示例13: TearDown

        $this->AssertEquals(is_object($this->createThing), true, $message = 'create thing');
        // then lets make sure it returns with a 200 status code
        $this->AssertEquals($this->showPerson->http_code, 200, $message = 'show person status code');
        $this->AssertEquals($this->findPerson->http_code, 200, $message = 'find person status code');
        $this->AssertEquals($this->createPerson->http_code, 200, $message = 'create person status code');
        $this->AssertEquals($this->showPlace->http_code, 200, $message = 'show place status code');
        $this->AssertEquals($this->findPlace->http_code, 200, $message = 'find place status code');
        $this->AssertEquals($this->createPlace->http_code, 200, $message = 'create place status code');
        $this->AssertEquals($this->showThing->http_code, 200, $message = 'show thing status code');
        $this->AssertEquals($this->findThing->http_code, 200, $message = 'find thing status code');
        $this->AssertEquals($this->createThing->http_code, 200, $message = 'create thing status code');
        // finally lets check the content type
        $this->AssertEquals($this->showPerson->http_info['content_type'], 'application/json; charset=utf-8', $message = 'show person content type');
        $this->AssertEquals($this->findPerson->http_info['content_type'], 'application/json; charset=utf-8', $message = 'find person content type');
        $this->AssertEquals($this->createPerson->http_info['content_type'], 'application/json; charset=utf-8', $message = 'create person content type');
        $this->AssertEquals($this->showPlace->http_info['content_type'], 'application/json; charset=utf-8', $message = 'show place content type');
        $this->AssertEquals($this->findPlace->http_info['content_type'], 'application/json; charset=utf-8', $message = 'find place content type');
        $this->AssertEquals($this->createPlace->http_info['content_type'], 'application/json; charset=utf-8', $message = 'create place content type');
        $this->AssertEquals($this->showThing->http_info['content_type'], 'application/json; charset=utf-8', $message = 'show thing content type');
        $this->AssertEquals($this->findThing->http_info['content_type'], 'application/json; charset=utf-8', $message = 'find thing content type');
        $this->AssertEquals($this->createThing->http_info['content_type'], 'application/json; charset=utf-8', $message = 'create thing content type');
    }
    public function TearDown()
    {
        unset($hyperpublic);
    }
}
$suite = new TestSuite();
$suite->AddTest('HyperpublicTest');
$runner = new TextTestRunner();
$runner->Run($suite, 'result');
开发者ID:hyperpublic,项目名称:hyperpublic_php,代码行数:31,代码来源:test.php

示例14: TearDown

        $this->doctrinemodel->flush();
        $groomFind = $this->doctrinemodel->getRepository('Models\\GameRoom')->findOneBy(array('name' => $gamename));
        $this->AssertEquals($groomFind->name, $gamename, 'gameroom persist');
        // User persist
        $user = new Models\User();
        $user->name = $username;
        $this->doctrinemodel->persist($user);
        $this->doctrinemodel->flush();
        $userFind = $this->doctrinemodel->getRepository('Models\\User')->findOneBy(array('name' => $username));
        $this->AssertEquals($userFind->name, $username, 'user persist');
        // Join Game
        $this->AssertEquals($groomFind->ConnectUser($userFind), TRUE, 'Call ConnectUser');
        $this->AssertEquals($groomFind->getConnectedUsers()->count(), 1);
        $this->AssertEquals($groomFind->getConnectedUsers()->contains($userFind), TRUE, 'Join Game');
        $this->AssertEquals($groomFind->DisconnectUser($userFind), TRUE, 'Call DisconnectUser');
        $this->AssertEquals($groomFind->getConnectedUsers()->count(), 0, 'Exit game user count');
        $this->AssertEquals($groomFind->getConnectedUsers()->contains($userFind), FALSE, 'Exit Game');
        $groomFind->ResetUsers();
        $this->AssertEquals($groomFind->getConnectedUsers()->count(), 0);
        $this->AssertEquals($groomFind->getConnectedUsers()->contains($userFind), FALSE, 'Reset Game Users');
    }
    public function TearDown()
    {
        $this->gameroom->drop();
        $this->users->drop();
    }
}
$suite = new TestSuite();
$suite->AddTest('GameRoomTest');
$runner = new TextTestRunner();
$runner->Run($suite, true);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:31,代码来源:gameroom_ut.php

示例15: Run

<?php

require_once '../odmconfig.php';
include_once './framework/amqptestcase.php';
class AMQPEventTest extends AMQPTestCase
{
    public function Run()
    {
        // Create a new queue
        $q1 = new AMQPQueue($this->cnn);
        $q1->declare('queue1');
        $q1->purge('queue1');
        $options = array('min' => 0, 'max' => 10, 'ack' => true);
        // Bind it on the exchange to routing.key
        $q1->bind(\Constant\AMQPChannelConstant::AMF, \Constant\AMQPCommand::BingoBroadcast);
        // Read from the queue
        while (TRUE) {
            $msg = $q1->consume($options);
            var_dump($msg);
        }
    }
}
$suite = new TestSuite();
$suite->AddTest('AMQPEventTest');
$runner = new TextTestRunner();
$runner->Run($suite, false);
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:26,代码来源:amqp_amfevent_ut.php


注:本文中的TestSuite::AddTest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。