'Request speed.', 'description' => 'Tests the speed', 'group' => 'Test', ); } /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->request = Request::createFromGlobals(); } /** * Tests the spped of creating new requests. */ public function testCreate() { $start = microtime(TRUE); for ($i = 0; $i < 10000; $i++) { $path = '/node/' . $i; $req = Request::create($path); } $end = microtime(TRUE); echo __METHOD__ . " elapsed: " . ($end - $start) ."\n\n"; } /** * Tests the spped of duplicating requests. */ public function testDuplicate() { $start = microtime(TRUE); for ($i = 0; $i < 10000; $i++) { $path = '/node/' . $i; $req = $this->request->duplicate(NULL, NULL, array('node' => $i)); $req->setMethod('GET'); $req->server->set('REQUEST_URI', $path); } $end = microtime(TRUE); echo __METHOD__ . " elapsed: " . ($end - $start) ."\n\n"; } /** */ public function testDuplicateWithUri() { $start = microtime(TRUE); for ($i = 0; $i < 10000; $i++) { $path = '/node/' . $i; $req = RequestHelper::duplicateWithUri($this->request, $path, 'GET', array('node' => $i)); } $end = microtime(TRUE); echo __METHOD__ . " elapsed: " . ($end - $start) ."\n\n"; } }