diff --git a/tests/SslCertificateSerializationTest.php b/tests/SslCertificateSerializationTest.php new file mode 100644 index 0000000..f9fe492 --- /dev/null +++ b/tests/SslCertificateSerializationTest.php @@ -0,0 +1,28 @@ +toArray() + ); + + expect(json_last_error_msg())->toEqual('Malformed UTF-8 characters, possibly incorrectly encoded'); +}); + +it('can json encode serialized certificate', function() { + $json = json_encode( + serialize(SslCertificate::createFromFile(__DIR__ . '/stubs/spatieCertificate.pem')) + ); + + expect(json_last_error_msg())->toEqual('No error'); +}); + +it('can unserialize serialized certificate', function() { + $serialized = serialize(SslCertificate::createFromFile(__DIR__ . '/stubs/spatieCertificate.pem')); + + $unserialized = unserialize($serialized); + + expect($unserialized->getDomain())->toEqual("analytics.spatie.be"); +}); \ No newline at end of file