From d665b27e970941ae746da7a53e919103f2cadf09 Mon Sep 17 00:00:00 2001 From: Edie Lemoine Date: Mon, 23 Oct 2023 15:03:14 +0200 Subject: [PATCH] test: update entry test --- tests/Unit/EntryTest.php | 17 +++++++++++++++++ .../EntryTest__it_has_hooks__1.json | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/__snapshots__/EntryTest__it_has_hooks__1.json diff --git a/tests/Unit/EntryTest.php b/tests/Unit/EntryTest.php index a7a937d9..e93b78c4 100644 --- a/tests/Unit/EntryTest.php +++ b/tests/Unit/EntryTest.php @@ -5,11 +5,28 @@ namespace MyParcelNL\PrestaShop; +use MyParcelNL\Pdk\Facade\Pdk; use MyParcelNL\PrestaShop\Tests\Uses\UsesMockPlugin; +use Throwable; use function MyParcelNL\Pdk\Tests\usesShared; +use function Spatie\Snapshots\assertMatchesJsonSnapshot; usesShared(new UsesMockPlugin()); it('boots plugin', function () { expect(true)->toBeTrue(); }); + +it('has hooks', function () { + assertMatchesJsonSnapshot(json_encode(Pdk::get('moduleHooks'))); +}); + +it('installs and uninstalls module', function () { + /** @var \MyParcelNL $module */ + $module = Pdk::get('moduleInstance'); + + expect($module->install()) + ->not->toThrow(Throwable::class) + ->and($module->uninstall()) + ->not->toThrow(Throwable::class); +}); diff --git a/tests/__snapshots__/EntryTest__it_has_hooks__1.json b/tests/__snapshots__/EntryTest__it_has_hooks__1.json new file mode 100644 index 00000000..136de518 --- /dev/null +++ b/tests/__snapshots__/EntryTest__it_has_hooks__1.json @@ -0,0 +1,16 @@ +[ + "displayBeforeCarrier", + "displayCarrierExtraContent", + "actionCarrierProcess", + "actionOrderGridDefinitionModifier", + "actionOrderGridPresenterModifier", + "actionObjectCustomerMessageAddAfter", + "displayAdminOrderMain", + "actionProductUpdate", + "displayAdminProductsExtra", + "displayAdminAfterHeader", + "displayAdminEndContent", + "displayBackOfficeHeader", + "displayHeader", + "actionCarrierUpdate" +]