|
|
|
@ -23,13 +23,11 @@ class Framework_Browser extends PHPUnit_Framework_TestCase
|
|
|
|
|
*/
|
|
|
|
|
function test_browser($useragent, $opera, $chrome, $ie, $ns, $safari, $mz)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$object = $this->getBrowser($useragent);
|
|
|
|
|
|
|
|
|
|
$this->assertEquals($opera, $object->opera, 'Check for Opera failed');
|
|
|
|
|
$this->assertEquals($chrome, $object->chrome, 'Check for Chrome failed');
|
|
|
|
|
$this->assertEquals($ie, $object->ie, 'Check for IE failed');
|
|
|
|
|
$this->assertEquals($ns, $object->ns, 'Check for NS failed');
|
|
|
|
|
$this->assertEquals($safari, $object->safari, 'Check for Safari failed');
|
|
|
|
|
$this->assertEquals($mz, $object->mz, 'Check for MZ failed');
|
|
|
|
|
}
|
|
|
|
@ -57,49 +55,11 @@ class Framework_Browser extends PHPUnit_Framework_TestCase
|
|
|
|
|
$this->assertEquals($version, $object->ver);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider dom
|
|
|
|
|
*/
|
|
|
|
|
function test_dom($useragent, $dom)
|
|
|
|
|
{
|
|
|
|
|
$object = $this->getBrowser($useragent);
|
|
|
|
|
$this->assertEquals($dom, $object->dom);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider pngalpha
|
|
|
|
|
*/
|
|
|
|
|
function test_pngalpha($useragent, $pngalpha)
|
|
|
|
|
{
|
|
|
|
|
$object = $this->getBrowser($useragent);
|
|
|
|
|
$this->assertEquals($pngalpha, $object->pngalpha);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider imgdata
|
|
|
|
|
*/
|
|
|
|
|
function test_imgdata($useragent, $imgdata)
|
|
|
|
|
{
|
|
|
|
|
$object = $this->getBrowser($useragent);
|
|
|
|
|
$this->assertEquals($imgdata, $object->imgdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function versions()
|
|
|
|
|
{
|
|
|
|
|
return $this->extractDataSet(array('version'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function pngalpha()
|
|
|
|
|
{
|
|
|
|
|
return $this->extractDataSet(array('canPNGALPHA'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function imgdata()
|
|
|
|
|
{
|
|
|
|
|
return $this->extractDataSet(array('canIMGDATA'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function extractDataSet($keys)
|
|
|
|
|
{
|
|
|
|
|
$keys = array_merge(array('useragent'), $keys);
|
|
|
|
@ -123,11 +83,6 @@ class Framework_Browser extends PHPUnit_Framework_TestCase
|
|
|
|
|
return $this->extractDataSet(array('lang'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function dom()
|
|
|
|
|
{
|
|
|
|
|
return $this->extractDataSet(array('hasDOM'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function browsers()
|
|
|
|
|
{
|
|
|
|
|
return $this->extractDataSet(array('isOpera','isChrome','isIE','isNS','isSafari','isMZ'));
|
|
|
|
@ -138,103 +93,84 @@ class Framework_Browser extends PHPUnit_Framework_TestCase
|
|
|
|
|
return array(
|
|
|
|
|
'WIN: Mozilla Firefox ' => array(
|
|
|
|
|
'useragent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1',
|
|
|
|
|
'version' => '1.8', //Version
|
|
|
|
|
'isWin' => true, //isWindows
|
|
|
|
|
'version' => '1.8',
|
|
|
|
|
'isWin' => true,
|
|
|
|
|
'isLinux' => false,
|
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
|
'isMZ' => true, //isMZ
|
|
|
|
|
'lang' => 'en-US', //lang
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
'isMac' => false,
|
|
|
|
|
'isUnix' => false,
|
|
|
|
|
'isOpera' => false,
|
|
|
|
|
'isChrome' => false,
|
|
|
|
|
'isIE' => false,
|
|
|
|
|
'isSafari' => false,
|
|
|
|
|
'isMZ' => true,
|
|
|
|
|
'lang' => 'en-US',
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
'LINUX: Bon Echo ' => array(
|
|
|
|
|
'useragent' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20070222 BonEcho/2.0.0.1',
|
|
|
|
|
'version' => '1.8', //Version
|
|
|
|
|
'isWin' => false, //isWindows
|
|
|
|
|
'version' => '1.8',
|
|
|
|
|
'isWin' => false,
|
|
|
|
|
'isLinux' => true,
|
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
|
'isMZ' => true, //isMZ
|
|
|
|
|
'lang' => 'en-US', //lang
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
'isMac' => false,
|
|
|
|
|
'isUnix' => false,
|
|
|
|
|
'isOpera' => false,
|
|
|
|
|
'isChrome' => false,
|
|
|
|
|
'isIE' => false,
|
|
|
|
|
'isSafari' => false,
|
|
|
|
|
'isMZ' => true,
|
|
|
|
|
'lang' => 'en-US',
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
'Chrome Mac' => array(
|
|
|
|
|
'useragent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.461.0 Safari/534.3',
|
|
|
|
|
'version' => '6', //Version
|
|
|
|
|
'isWin' => false, //isWindows
|
|
|
|
|
'version' => '6',
|
|
|
|
|
'isWin' => false,
|
|
|
|
|
'isLinux' => false,
|
|
|
|
|
'isMac' => true, //isMac
|
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
|
'isChrome' => true, //isChrome
|
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
|
'isMZ' => false, //isMZ
|
|
|
|
|
'lang' => 'en-US', //lang
|
|
|
|
|
'hasDOM' => false, //hasDOM
|
|
|
|
|
'canPNGALPHA' => false, //canPNGALPHA
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
'isMac' => true,
|
|
|
|
|
'isUnix' => false,
|
|
|
|
|
'isOpera' => false,
|
|
|
|
|
'isChrome' => true,
|
|
|
|
|
'isIE' => false,
|
|
|
|
|
'isSafari' => false,
|
|
|
|
|
'isMZ' => false,
|
|
|
|
|
'lang' => 'en-US',
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
'IE 11' => array(
|
|
|
|
|
'useragent' => 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko',
|
|
|
|
|
'version' => '11.0', //Version
|
|
|
|
|
'isWin' => true, //isWindows
|
|
|
|
|
'version' => '11.0',
|
|
|
|
|
'isWin' => true,
|
|
|
|
|
'isLinux' => false,
|
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
|
'isIE' => true, //isIE
|
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
|
'isMZ' => false, //isMZ
|
|
|
|
|
'lang' => '', //lang
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
'canIMGDATA' => false, //canIMGDATA
|
|
|
|
|
'isMac' => false,
|
|
|
|
|
'isUnix' => false,
|
|
|
|
|
'isOpera' => false,
|
|
|
|
|
'isChrome' => false,
|
|
|
|
|
'isIE' => true,
|
|
|
|
|
'isSafari' => false,
|
|
|
|
|
'isMZ' => false,
|
|
|
|
|
'lang' => '',
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
'Opera 15' => array(
|
|
|
|
|
'useragent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.29 Safari/537.36 OPR/15.0.1147.24',
|
|
|
|
|
'version' => '15.0', //Version
|
|
|
|
|
'isWin' => true, //isWindows
|
|
|
|
|
'version' => '15.0',
|
|
|
|
|
'isWin' => true,
|
|
|
|
|
'isLinux' => false,
|
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
|
'isOpera' => true, //isOpera
|
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
|
'isMZ' => false, //isMZ
|
|
|
|
|
'lang' => '', //lang
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
'isMac' => false,
|
|
|
|
|
'isUnix' => false,
|
|
|
|
|
'isOpera' => true,
|
|
|
|
|
'isChrome' => false,
|
|
|
|
|
'isIE' => false,
|
|
|
|
|
'isSafari' => false,
|
|
|
|
|
'isMZ' => false,
|
|
|
|
|
'lang' => '',
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function os()
|
|
|
|
|
{
|
|
|
|
|
return $this->extractDataSet(array('isWin','isLinux','isUnix','isMac'));
|
|
|
|
|
return $this->extractDataSet(array('isWin', 'isLinux', 'isUnix', 'isMac'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|