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); }
public function testLogErrorDuringUnzerialize() { error_reporting(E_ALL | E_STRICT); $this->object->get_messages(); $db = $this->getConnection()->getConnection()->query("INSERT INTO polling_messages (uid, message) VALUES (1, '\"')"); ob_start(); $messages_from_DAO = $this->object->get_messages(); $output = ob_get_contents(); ob_end_clean(); $this->assertContains('Error while processing row', $output); $this->assertContains('Notice: unserialize(): Error', $output); }