public function testGetTimeZoneFromCookie() { $request = new CM_Http_Request_Get('/foo/bar/', ['cookie' => 'timezoneOffset=9000; clientId=7']); $timeZone = $request->getTimeZone(); $this->assertInstanceOf('DateTimeZone', $timeZone); $this->assertSame('-02:30', $timeZone->getName()); $request = new CM_Http_Request_Get('/foo/bar/', ['cookie' => 'timezoneOffset=-9000; clientId=7']); $timeZone = $request->getTimeZone(); $this->assertInstanceOf('DateTimeZone', $timeZone); $this->assertSame('+02:30', $timeZone->getName()); $request = new CM_Http_Request_Post('/foo/bar/', ['cookie' => 'timezoneOffset=3600']); $timeZone = $request->getTimeZone(); $this->assertInstanceOf('DateTimeZone', $timeZone); $this->assertSame('-01:00', $timeZone->getName()); $request = new CM_Http_Request_Post('/foo/bar/', ['cookie' => 'timezoneOffset=50400']); $timeZone = $request->getTimeZone(); $this->assertNull($timeZone); $request = new CM_Http_Request_Post('/foo/bar/', ['cookie' => 'timezoneOffset=-62400']); $timeZone = $request->getTimeZone(); $this->assertNull($timeZone); $request = new CM_Http_Request_Get('/foo/baz/'); $timeZone = $request->getTimeZone(); $this->assertNull($timeZone); }