public function testGetOrCreate()
 {
     $_SERVER['HTTP_USER_AGENT'] = fake_uagent();
     $device = $this->device_model->getOrCreate($this->test_data->the_gateway->serial, $this->test_data->the_user->id, $this->test_data->the_device->mac);
     $this->assertEquals($device->id, $this->test_data->the_device->id);
     $device = $this->device_model->getOrCreate($this->test_data->the_gateway->serial, $this->test_data->the_user->id, fake_mac());
     $this->assertNotEquals($device->id, $this->test_data->the_device->id);
     print_r($this->device_model->load($device->id));
 }
 public function doSetUp()
 {
     $this->library('test_data');
     $this->model('loginrequest_model');
     $this->test_data->addTheUser();
     $this->test_data->addTheGateway();
     $this->test_data->addTheDevice();
     $_SERVER['HTTP_USER_AGENT'] = fake_uagent();
 }
 public function setUp()
 {
     $mute = getenv('MUTE_PHPUNIT');
     $ref = new ReflectionClass($this);
     $func = $this->getName();
     if (!$mute && $func != 'testStub') {
         echo "\n----------" . $ref->name . " | " . $func . "----------\n";
     }
     $this->CI =& get_instance();
     $this->doSetUp();
     $this->CI->load->helper(array('url', 'test'));
     $this->CI->load->spark('curl/1.3.0');
     $this->CI->curl->http_header('User-Agent', fake_uagent());
 }
 public function testUAParser()
 {
     $this->helper('uagent');
     $agent = fake_uagent();
     $result = parse_uagent($agent);
     $this->assertNotNull($result->os);
     $this->assertNotNull($result->device);
     $this->assertNotNull($result->ua);
     print_r($result);
 }
 public function testFakeUserAgetn()
 {
     $this->assertNotNull(fake_uagent());
 }
Ejemplo n.º 6
0
function fake_device($owner_id, $gateway_id)
{
    list($browser, $os) = chooseRandomBrowserAndOs();
    return array('owner_id' => $owner_id, 'gateway_id' => $gateway_id, 'mac' => fake_mac(), 'os' => $os, 'uagent' => fake_uagent());
}