예제 #1
0
 public function testMemoryUsage()
 {
     $db = $this->getConnection()->getConnection();
     $mu = array(1000 => memory_get_usage(), 2499 => memory_get_usage() + 1);
     for ($pass = 1; $pass < 2500; $pass++) {
         $this->object->get_uid_for_session('c4ca4238a0b923820dcc509a6f75849b');
         $this->object->get_messages();
         if ($pass == 1000 || $pass == 2499) {
             $mu[$pass] = memory_get_usage();
         }
         /*if ($pass % 100 == 0) {
             print("Memory usage after pass #$pass: "******"\n");
           }*/
         $db->query("INSERT INTO polling_messages (uid, message) VALUES (1, 's:{$pass}:\"" . str_repeat('x', $pass) . "\";')");
     }
     $this->assertTrue($mu[1000] / 10 >= $mu[2499] / 10);
 }
예제 #2
0
 public function testGetUidForSession()
 {
     $this->assertEquals(1, $this->object->get_uid_for_session(md5(1)));
     $this->assertFalse($this->object->get_uid_for_session(md5(2)));
 }