Chris@14: Chris@14: */ Chris@14: Chris@14: namespace Test\WebDriver; Chris@14: Chris@14: use WebDriver\Exception; Chris@14: Chris@14: /** Chris@14: * Test WebDriver\Exception class Chris@14: * Chris@14: * @package WebDriver Chris@14: * Chris@14: * @group Unit Chris@14: */ Chris@14: class ExceptionTest extends \PHPUnit_Framework_TestCase Chris@14: { Chris@14: /** Chris@14: * test factory() Chris@14: */ Chris@14: public function testFactory() Chris@14: { Chris@14: $out = Exception::factory(255, 'wtf'); Chris@14: $this->assertTrue(get_class($out) === 'Exception'); Chris@14: $this->assertTrue($out->getMessage() === 'wtf'); Chris@14: Chris@14: $out = Exception::factory(Exception::SUCCESS); Chris@14: $this->assertTrue(get_class($out) === 'Exception'); Chris@14: $this->assertTrue($out->getMessage() === 'Unknown Error'); Chris@14: Chris@14: $out = Exception::factory(Exception::CURL_EXEC); Chris@14: $this->assertTrue($out instanceof Exception\CurlExec); Chris@14: $this->assertTrue($out->getMessage() === 'curl_exec() error.'); Chris@14: } Chris@14: }