Ejemplo n.º 1
0
 public static function getTestChain($name)
 {
     $path = TESTING_DIRECTORY . '/Certs/' . $name . '/';
     if (!file_exists($path) || !is_dir($path)) {
         throw new \Exception('Requested certificate files not found at: ' . $path);
     }
     $certPaths = array();
     $files = scandir($path);
     foreach ($files as $file) {
         if (substr($file, -4) !== '.crt') {
             continue;
         }
         $certPaths[] = $path . $file;
     }
     return CertFactory::getCertFromFiles($certPaths);
 }
Ejemplo n.º 2
0
 /**
  * @expectedException RuntimeException
  */
 public function testGetCertFromFiles_WrongPathException()
 {
     $files = array('/fakepath/cert1.crt', '/fakepath/cert2.crt', '/fakepath/cert3.crt');
     CertFactory::getCertFromFiles($files);
 }