|
|
@ -23,13 +23,11 @@ class Framework_Browser extends PHPUnit_Framework_TestCase
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function test_browser($useragent, $opera, $chrome, $ie, $ns, $safari, $mz)
|
|
|
|
function test_browser($useragent, $opera, $chrome, $ie, $ns, $safari, $mz)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
$object = $this->getBrowser($useragent);
|
|
|
|
$object = $this->getBrowser($useragent);
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals($opera, $object->opera, 'Check for Opera failed');
|
|
|
|
$this->assertEquals($opera, $object->opera, 'Check for Opera failed');
|
|
|
|
$this->assertEquals($chrome, $object->chrome, 'Check for Chrome failed');
|
|
|
|
$this->assertEquals($chrome, $object->chrome, 'Check for Chrome failed');
|
|
|
|
$this->assertEquals($ie, $object->ie, 'Check for IE 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($safari, $object->safari, 'Check for Safari failed');
|
|
|
|
$this->assertEquals($mz, $object->mz, 'Check for MZ 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);
|
|
|
|
$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()
|
|
|
|
function versions()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->extractDataSet(array('version'));
|
|
|
|
return $this->extractDataSet(array('version'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function pngalpha()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return $this->extractDataSet(array('canPNGALPHA'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function imgdata()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return $this->extractDataSet(array('canIMGDATA'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function extractDataSet($keys)
|
|
|
|
private function extractDataSet($keys)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$keys = array_merge(array('useragent'), $keys);
|
|
|
|
$keys = array_merge(array('useragent'), $keys);
|
|
|
@ -123,11 +83,6 @@ class Framework_Browser extends PHPUnit_Framework_TestCase
|
|
|
|
return $this->extractDataSet(array('lang'));
|
|
|
|
return $this->extractDataSet(array('lang'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function dom()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return $this->extractDataSet(array('hasDOM'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function browsers()
|
|
|
|
function browsers()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->extractDataSet(array('isOpera','isChrome','isIE','isNS','isSafari','isMZ'));
|
|
|
|
return $this->extractDataSet(array('isOpera','isChrome','isIE','isNS','isSafari','isMZ'));
|
|
|
@ -138,103 +93,84 @@ class Framework_Browser extends PHPUnit_Framework_TestCase
|
|
|
|
return array(
|
|
|
|
return array(
|
|
|
|
'WIN: Mozilla Firefox ' => 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',
|
|
|
|
'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
|
|
|
|
'version' => '1.8',
|
|
|
|
'isWin' => true, //isWindows
|
|
|
|
'isWin' => true,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
'isMac' => false,
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
'isUnix' => false,
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
'isOpera' => false,
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
'isChrome' => false,
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
'isIE' => false,
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
'isSafari' => false,
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
'isMZ' => true,
|
|
|
|
'isMZ' => true, //isMZ
|
|
|
|
'lang' => 'en-US',
|
|
|
|
'lang' => 'en-US', //lang
|
|
|
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
'LINUX: Bon Echo ' => array(
|
|
|
|
'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',
|
|
|
|
'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
|
|
|
|
'version' => '1.8',
|
|
|
|
'isWin' => false, //isWindows
|
|
|
|
'isWin' => false,
|
|
|
|
'isLinux' => true,
|
|
|
|
'isLinux' => true,
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
'isMac' => false,
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
'isUnix' => false,
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
'isOpera' => false,
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
'isChrome' => false,
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
'isIE' => false,
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
'isSafari' => false,
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
'isMZ' => true,
|
|
|
|
'isMZ' => true, //isMZ
|
|
|
|
'lang' => 'en-US',
|
|
|
|
'lang' => 'en-US', //lang
|
|
|
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
'Chrome Mac' => array(
|
|
|
|
'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',
|
|
|
|
'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
|
|
|
|
'version' => '6',
|
|
|
|
'isWin' => false, //isWindows
|
|
|
|
'isWin' => false,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isMac' => true, //isMac
|
|
|
|
'isMac' => true,
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
'isUnix' => false,
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
'isOpera' => false,
|
|
|
|
'isChrome' => true, //isChrome
|
|
|
|
'isChrome' => true,
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
'isIE' => false,
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
'isSafari' => false,
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
'isMZ' => false,
|
|
|
|
'isMZ' => false, //isMZ
|
|
|
|
'lang' => 'en-US',
|
|
|
|
'lang' => 'en-US', //lang
|
|
|
|
|
|
|
|
'hasDOM' => false, //hasDOM
|
|
|
|
|
|
|
|
'canPNGALPHA' => false, //canPNGALPHA
|
|
|
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
'IE 11' => array(
|
|
|
|
'IE 11' => array(
|
|
|
|
'useragent' => 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko',
|
|
|
|
'useragent' => 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko',
|
|
|
|
'version' => '11.0', //Version
|
|
|
|
'version' => '11.0',
|
|
|
|
'isWin' => true, //isWindows
|
|
|
|
'isWin' => true,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
'isMac' => false,
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
'isUnix' => false,
|
|
|
|
'isOpera' => false, //isOpera
|
|
|
|
'isOpera' => false,
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
'isChrome' => false,
|
|
|
|
'isIE' => true, //isIE
|
|
|
|
'isIE' => true,
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
'isSafari' => false,
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
'isMZ' => false,
|
|
|
|
'isMZ' => false, //isMZ
|
|
|
|
'lang' => '',
|
|
|
|
'lang' => '', //lang
|
|
|
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
|
|
|
'canIMGDATA' => false, //canIMGDATA
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
'Opera 15' => array(
|
|
|
|
'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',
|
|
|
|
'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
|
|
|
|
'version' => '15.0',
|
|
|
|
'isWin' => true, //isWindows
|
|
|
|
'isWin' => true,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isLinux' => false,
|
|
|
|
'isMac' => false, //isMac
|
|
|
|
'isMac' => false,
|
|
|
|
'isUnix' => false, //isUnix
|
|
|
|
'isUnix' => false,
|
|
|
|
'isOpera' => true, //isOpera
|
|
|
|
'isOpera' => true,
|
|
|
|
'isChrome' => false, //isChrome
|
|
|
|
'isChrome' => false,
|
|
|
|
'isIE' => false, //isIE
|
|
|
|
'isIE' => false,
|
|
|
|
'isNS' => false, //isNS
|
|
|
|
'isSafari' => false,
|
|
|
|
'isSafari' => false, //isSafari
|
|
|
|
'isMZ' => false,
|
|
|
|
'isMZ' => false, //isMZ
|
|
|
|
'lang' => '',
|
|
|
|
'lang' => '', //lang
|
|
|
|
|
|
|
|
'hasDOM' => true, //hasDOM
|
|
|
|
|
|
|
|
'canPNGALPHA' => true, //canPNGALPHA
|
|
|
|
|
|
|
|
'canIMGDATA' => true, //canIMGDATA
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function os()
|
|
|
|
function os()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->extractDataSet(array('isWin','isLinux','isUnix','isMac'));
|
|
|
|
return $this->extractDataSet(array('isWin', 'isLinux', 'isUnix', 'isMac'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|