lithium\tests\cases\action\RequestTest::testDetect PHP Метод

testDetect() публичный Метод

public testDetect ( )
    public function testDetect()
    {
        $request = new Request(array('env' => array('SOME_COOL_DETECTION' => true)));
        $request->detect('cool', 'SOME_COOL_DETECTION');
        $this->assertTrue($request->is('cool'));
        $this->assertFalse($request->is('foo'));
        $request = new Request(array('env' => array('HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; XXXXX like Mac OS X; en) AppleWebKit/420+')));
        $request->detect('iPhone', array('HTTP_USER_AGENT', '/iPhone/'));
        $isiPhone = $request->is('iPhone');
        // returns true if 'iPhone' appears anywhere in the UA
        $this->assertTrue($isiPhone);
    }
RequestTest