-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add the ability to load from file a DER based certificate (#177)
* add the ability to load from file a DER based certificate * move der2pem function to SslCertificate class as a static function * modify the url for different port test (connection problem fo previous host)
- Loading branch information
1 parent
b40b2a5
commit 69a61d2
Showing
6 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Spatie\SslCertificate\Test; | ||
|
||
use Carbon\Carbon; | ||
use PHPUnit\Framework\TestCase; | ||
use Spatie\Snapshots\MatchesSnapshots; | ||
use Spatie\SslCertificate\SslCertificate; | ||
|
||
class SslCertificateFromFileTest extends TestCase | ||
{ | ||
use MatchesSnapshots; | ||
|
||
/** @var Spatie\SslCertificate\SslCertificate */ | ||
protected $certificate; | ||
|
||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
Carbon::setTestNow(Carbon::create('2020', '01', '13', '03', '18', '13', 'utc')); | ||
|
||
|
||
} | ||
|
||
/** @test */ | ||
public function it_can_load_pem_certificate() | ||
{ | ||
$this->certificate = SslCertificate::createFromFile(__DIR__.'/stubs/spatieCertificate.pem'); | ||
$this->assertSame("Let's Encrypt", $this->certificate->getOrganization()); | ||
$this->assertSame("analytics.spatie.be", $this->certificate->getDomain()); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_load_der_certificate() | ||
{ | ||
$this->certificate = SslCertificate::createFromFile(__DIR__.'/stubs/derCertificate.der'); | ||
$this->assertSame("Let's Encrypt", $this->certificate->getOrganization()); | ||
$this->assertSame("analytics.spatie.be", $this->certificate->getDomain()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.