Exemplo n.º 1
0
 /**
  * @expectedException              Exception
  * @expectedExceptionMessageRegExp #Curl error#
  */
 public function testUnknownHost()
 {
     $message = 'test' . mt_rand(1, 10000);
     $config = (include '_config.php');
     if (!$this->checkConfig($config)) {
         $this->markTestSkipped('Config is empty');
         return;
     }
     $fiscal_verification = new \Neonbug\FiscalVerification\FiscalVerification($config['client_key_filename'], $config['client_key_password'], $config['ca_public_key_filename'], 'https://unknown-host');
     $response = $fiscal_verification->sendEcho($message);
 }
Exemplo n.º 2
0
 public function testHeader()
 {
     $config = (include '_config.php');
     if (!$this->checkConfig($config)) {
         $this->markTestSkipped('Config is empty');
         return;
     }
     $fiscal_verification = new \Neonbug\FiscalVerification\FiscalVerification($config['client_key_filename'], $config['client_key_password'], $config['ca_public_key_filename'], $config['base_url']);
     $header = $fiscal_verification->generateHeader();
     $this->assertJsonStringEqualsJsonString($header, json_encode(array('alg' => 'RS256', 'serial' => $config['client_key_info']['serial'], 'issuer_name' => $config['client_key_info']['issuer_name'], 'subject_name' => $config['client_key_info']['subject_name'])));
 }
Exemplo n.º 3
0
 /**
  * @expectedException              Exception
  * @expectedExceptionMessageRegExp #Error reading certs.*#
  */
 public function testPrivateKeyReadFail()
 {
     $config = (include '_config.php');
     if (!$this->checkConfig($config)) {
         $this->markTestSkipped('Config is empty');
         return;
     }
     $fiscal_verification = new \Neonbug\FiscalVerification\FiscalVerification($config['client_key_filename'], 'wrongpass', $config['ca_public_key_filename'], $config['base_url']);
     $test_zoi = '1234567801.01.2015 01:00:00123premise1edevice130.41';
     $signature = $fiscal_verification->signZoi($test_zoi, false);
 }
Exemplo n.º 4
0
 public function testEcho()
 {
     $message = 'test' . mt_rand(1, 10000);
     $config = (include '_config.php');
     if (!$this->checkConfig($config)) {
         $this->markTestSkipped('Config is empty');
         return;
     }
     $fiscal_verification = new \Neonbug\FiscalVerification\FiscalVerification($config['client_key_filename'], $config['client_key_password'], $config['ca_public_key_filename'], $config['base_url']);
     $response = $fiscal_verification->sendEcho($message);
     $this->assertJsonStringEqualsJsonString(json_encode($response), json_encode(array('EchoResponse' => $message)));
 }