From ab92012a089959a1925a8d76855a1033b5225e46 Mon Sep 17 00:00:00 2001 From: Joseph Szobody Date: Thu, 27 Jun 2024 18:21:41 -0400 Subject: [PATCH] serialization test --- tests/SslCertificateSerializationTest.php | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/SslCertificateSerializationTest.php 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