Skip to content

Commit

Permalink
Skeleton remaining test methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieajau committed Sep 19, 2011
1 parent 1e5ba39 commit adf09f2
Showing 1 changed file with 64 additions and 32 deletions.
96 changes: 64 additions & 32 deletions tests/suite/joomla/application/web/JWebClientTest.php
Expand Up @@ -23,27 +23,6 @@ class JWebClientTest extends PHPUnit_Framework_TestCase
*/
protected $inspector;

/**
* Setup for testing.
*
* @return void
*
* @since 11.3
*/
public function setUp()
{
// Setup the system logger to echo all.
JLog::addLogger(array('logger' => 'echo'), JLog::ALL);

$_SERVER['HTTP_HOST'] = 'mydomain.com';
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0';

// Get a new JWebInspector instance.
$this->inspector = new JWebClientInspector();

parent::setUp();
}

/**
* Provides test data for user agent parsing.
*
Expand Down Expand Up @@ -88,6 +67,43 @@ public static function getUserAgentData()
);
}

/**
* Setup for testing.
*
* @return void
*
* @since 11.3
*/
public function setUp()
{
// Setup the system logger to echo all.
JLog::addLogger(array('logger' => 'echo'), JLog::ALL);

$_SERVER['HTTP_HOST'] = 'mydomain.com';
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0';

// Get a new JWebInspector instance.
$this->inspector = new JWebClientInspector();

parent::setUp();
}

/**
* Tests the JWebClient::__construct method.
*/
public function test__construct()
{
$this->markTestIncomplete();
}

/**
* Tests the JWebClient::__get method.
*/
public function test__get()
{
$this->markTestIncomplete();
}

/**
* Tests the JWebClient::detectBrowser method.
*
Expand All @@ -113,7 +129,15 @@ public function testDetectBrowser($p, $m, $e, $b, $v, $ua)
}

/**
* Tests the JWebClient::detectPlatform method.
* Tests the JWebClient::detectEncoding method.
*/
public function testDetectEncoding()
{
$this->markTestIncomplete();
}

/**
* Tests the JWebClient::detectEngine method.
*
* @param string $p The expected platform.
* @param boolean $m The expected mobile result.
Expand All @@ -127,17 +151,24 @@ public function testDetectBrowser($p, $m, $e, $b, $v, $ua)
* @dataProvider getUserAgentData
* @since 11.3
*/
public function testDetectPlatform($p, $m, $e, $b, $v, $ua)
public function testDetectEngine($p, $m, $e, $b, $v, $ua)
{
$this->inspector->detectPlatform($ua);
$this->inspector->detectEngine($ua);

// Test the assertions.
$this->assertEquals($this->inspector->mobile, $m, 'Mobile detection failed.');
$this->assertEquals($this->inspector->platform, $p, 'Platform detection failed.');
// Test the assertion.
$this->assertEquals($this->inspector->engine, $e, 'Engine detection failed.');
}

/**
* Tests the JWebClient::detectEngine method.
* Tests the JWebClient::detectLanguage method.
*/
public function testDetectLanguage()
{
$this->markTestIncomplete();
}

/**
* Tests the JWebClient::detectPlatform method.
*
* @param string $p The expected platform.
* @param boolean $m The expected mobile result.
Expand All @@ -151,11 +182,12 @@ public function testDetectPlatform($p, $m, $e, $b, $v, $ua)
* @dataProvider getUserAgentData
* @since 11.3
*/
public function testDetectEngine($p, $m, $e, $b, $v, $ua)
public function testDetectPlatform($p, $m, $e, $b, $v, $ua)
{
$this->inspector->detectEngine($ua);
$this->inspector->detectPlatform($ua);

// Test the assertion.
$this->assertEquals($this->inspector->engine, $e, 'Engine detection failed.');
// Test the assertions.
$this->assertEquals($this->inspector->mobile, $m, 'Mobile detection failed.');
$this->assertEquals($this->inspector->platform, $p, 'Platform detection failed.');
}
}

0 comments on commit adf09f2

Please sign in to comment.