/** * @depends testDeviceIsOnLine */ public function testGetAndSetAndDeleteUserTemplate(TAD $tad) { $user_info = ['pin' => 123, 'name' => 'Foo Bar', 'password' => 8888, 'privilege' => 0]; $template1_vx9 = "ocosgoulTUEdNKVRwRQ0I27BDTEkdMEONK9KQQunMVSBK6VPLEENk9MwgQ+DP3PBC1FTXEEG4ihpQQQ3vFQBO4K+WwERYilHAQ8ztktBEBbKQ0ELDtJrwQ7dqCiBCz+/IgEGKrBjQQhEO0zBFQNDQYEKFbhrQQdLF1wBDxclfUELMNFXwQRvvmHBCslKUAEZfU1OQRzmIU5BXRW0eoEKPMltgQnQGUyBJQSfRIEUSzIdAQ45l3gBByHUTMEJ5yVhQQmi0UZBFHvYPUEGeKxTAQ6rFGNBCIYURoEOZS9VwR+1M4RoE5m0DRUTF8DHd6HdqxHAxWmj393M28DDX2FkanKi/t7LGsDCWqGarmt1BaL/25nAwVaiipu/cgcQGKG6mcDBU6KYmr5wChQcobmJIsDBUKKJmZ1uExyi+ZaYwMFMgU2CQCSinYdnJsDBR4Ghl3Q4owa3dnfAwUamdlZlR5p2Zi7AwUSndERlfOpWZlfAwUOiQzVkLDhDopRUVTLAwT2iQ0ZjIzVMolNFRcDBN6I0ZlQebVaiEjRVwMEyolVVUxVxXKEBRUTAwS+iZVYyD3JhoQJFTMDBLKJlVUIKcWShBVVTwMIkoWVkFQhyaaEVZ1rAwh6hVlUPAW+iNGd3wMIToWdlBnWiRWZ3aMDDCqRmZjRpZmrAxASjd2Vnh2/gAA=="; $template1_data = ['pin' => $user_info['pin'], 'finger_id' => 0, 'size' => 514, 'valid' => 1, 'template' => $template1_vx9]; $no_template_response = $this->build_expected_response('GetUserTemplateResponse', false, 'No data!'); $expected_set_user_template_response = $this->build_expected_response('SetUserTemplateResponse'); $expected_delete_template_response = $this->build_expected_response('DeleteTemplateResponse'); // Create a test user. $tad->set_user_info($user_info); // GetUserTemplate test section. $before_set_template = $tad->get_user_template(['pin' => $user_info['pin']]); $this->assertEquals($no_template_response, $before_set_template->to_xml()); // SetUerTemplate test section. $response = $tad->set_user_template($template1_data); $this->assertEquals($expected_set_user_template_response, $response->to_xml()); $after_set_template = $tad->get_user_template(['pin' => $user_info['pin']]); $raw_after_template = $after_set_template->to_array($after_set_template)['Row']['Template']; $this->assertNotEmpty($after_set_template); $this->assertEquals($template1_vx9, $raw_after_template); // DeleteTemplate test section. $response = $tad->delete_template(['pin' => $user_info['pin']]); $this->assertEquals($expected_delete_template_response, $response->to_xml()); $after_delete_template = $tad->get_user_template(['pin' => $user_info['pin']]); $this->assertEquals($no_template_response, $after_delete_template->to_xml()); // Delete the test user created above. $tad->delete_user(['pin' => $user_info['pin']]); }