public function test_generate_zip()
 {
     $manager = new Pass_File_Manager($this->pass);
     \Fuel\Core\File::copy(APPPATH . 'tests/certificate.p12', $manager->file_path('certificate.p12'));
     $cert_password = '';
     $manager->generate_file('pass.json', $this->pass->pass_json());
     $manager->generate_file('manifest.json', $this->pass->manifest($manager->files()));
     $cert = new Certificate($manager->file_path('certificate.p12'));
     $signature = $cert->signature($manager->file_path('manifest.json'), $manager->file_path('signature'));
     $manager->generate_file('signature', $signature);
     $this->assertTrue($manager->generate_zip());
     $this->assertFileExists($manager->pkpass_path());
 }
示例#2
0
 public function generate($cert_password = '')
 {
     $manager = new Pass_File_Manager($this);
     $cert = new Certificate($manager->file_path('certificate.p12'), $cert_password);
     if (!$manager->generate_file('pass.json', $this->pass_json($cert->pass_type_identifier(), $cert->team_identifier()))) {
         return $manager->error;
     }
     if (!$manager->generate_file('manifest.json', $this->manifest($manager->files()))) {
         return $manager->error;
     }
     if (!($signature = $cert->signature($manager->file_path('manifest.json'), $manager->file_path('signature')))) {
         return $cert->error;
     }
     if (!$manager->generate_file('signature', $signature)) {
         return $manager->error;
     }
     if (!$manager->generate_zip()) {
         return $manager->error;
     }
     return null;
 }