public function testLogout()
 {
     $this->setSuccess();
     $this->setUserAuthInfo();
     Authentication::login();
     Authentication::logout();
     $this->assertFalse(isset($_SESSION[Authentication::ID_CARD_USER_AUTH_SESSION_KEY]));
 }
 public function testStartSession()
 {
     $this->setSuccess();
     $this->setUserAuthInfo();
     Authentication::login();
     $service = new SignatureService();
     $service->setWsdl();
     $service->initSoap();
     $this->assertTrue(is_int($service->startSession($this->testFileName)));
     $this->assertEquals('https://tsp.demo.sk.ee/?wsdl', $service->getWsdl());
 }
Exemple #3
0
 public function testSigningProcess()
 {
     if ($this->getConfig()['signature']['hex'] === null) {
         $this->markTestSkipped('Test skipped, because no config was found.');
     }
     // login
     $this->setSuccess();
     $this->setUserAuthInfo();
     Authentication::login();
     // start session
     $service = new SignatureService();
     $service->setWsdl();
     $service->initSoap();
     $sessionCode = $service->startSession($this->testFileName);
     // prepare
     $certificateConfig = $this->getConfig()['certificate'];
     $info = $service->prepareSignature($sessionCode, $certificateConfig['id'], $certificateConfig['hex']);
     //finalize
     $info2 = $service->finalizeSignature($sessionCode, $info['SignatureId'], $this->getConfig()['signature']['hex']);
 }
 public function startDdockSession($documentPath, $storePath)
 {
     if (!Authentication::isUserLoggedIn()) {
         Authentication::login();
     }
     try {
         $contents = file_get_contents($documentPath);
         $contents = $this->prepareDdocDataFile($contents, $storePath);
         $result = $this->soap->startSession("", $contents, true)['Sesscode'];
         if (is_int($result)) {
             return $result;
         } else {
             throw new SigningException($result['Status']);
         }
     } catch (\SoapFault $e) {
         throw $this->soapError($e);
     }
 }