Пример #1
0
        $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);
Пример #2
0
{
    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);
Пример #3
0
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);
Пример #4
0
        $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');