From 61f0da714c5253480167e126b586d45fcec6262e Mon Sep 17 00:00:00 2001 From: Lloric Mayuga Garcia Date: Mon, 25 Mar 2024 12:14:10 +0800 Subject: [PATCH] Fix deprecated calls in test (#187) Signed-off-by: Lloric Mayuga Garcia --- tests/DownloaderTest.php | 4 ++-- tests/SslCertificateFromFileTest.php | 4 ++-- tests/UrlTest.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/DownloaderTest.php b/tests/DownloaderTest.php index d8914e3..d4470a5 100644 --- a/tests/DownloaderTest.php +++ b/tests/DownloaderTest.php @@ -88,11 +88,11 @@ }); it('throws an exception for non existing host') - ->tap(fn () => Downloader::downloadCertificateFromUrl('spatie-non-existing.be')) + ->defer(fn () => Downloader::downloadCertificateFromUrl('spatie-non-existing.be')) ->throws(HostDoesNotExist::class); it('throws an exception when downloading a certificate from a host that contains none') - ->tap(fn () => Downloader::downloadCertificateFromUrl('3564020356.org')) + ->defer(fn () => Downloader::downloadCertificateFromUrl('3564020356.org')) ->throws(UnknownError::class); it('throws an exception when downloading a certificate for a missing host name from an ip address', function () { diff --git a/tests/SslCertificateFromFileTest.php b/tests/SslCertificateFromFileTest.php index ddb1e7d..30081d0 100644 --- a/tests/SslCertificateFromFileTest.php +++ b/tests/SslCertificateFromFileTest.php @@ -8,11 +8,11 @@ }); it('can load pem certificate') - ->tap(fn () => $this->certificate = SslCertificate::createFromFile(__DIR__ . '/stubs/spatieCertificate.pem')) + ->defer(fn () => $this->certificate = SslCertificate::createFromFile(__DIR__ . '/stubs/spatieCertificate.pem')) ->expect(fn () => $this->certificate->getOrganization())->toEqual("Let's Encrypt") ->and(fn () => $this->certificate->getDomain())->toEqual("analytics.spatie.be"); it('can load der certificate') - ->tap(fn () => $this->certificate = SslCertificate::createFromFile(__DIR__ . '/stubs/derCertificate.der')) + ->defer(fn () => $this->certificate = SslCertificate::createFromFile(__DIR__ . '/stubs/derCertificate.der')) ->expect(fn () => $this->certificate->getOrganization())->toEqual("Let's Encrypt") ->and(fn () => $this->certificate->getDomain())->toEqual("analytics.spatie.be"); diff --git a/tests/UrlTest.php b/tests/UrlTest.php index 2a38c21..4a6c99f 100644 --- a/tests/UrlTest.php +++ b/tests/UrlTest.php @@ -16,7 +16,7 @@ }); it('throws an exception when creating an url from an empty string') - ->tap(fn () => new Url('')) + ->defer(fn () => new Url('')) ->throws(InvalidUrl::class); it('can assume a default port when not explicitly defined', function () {