From 98fde54752e414eeda2d61217e813c96065d35ef Mon Sep 17 00:00:00 2001 From: makao Date: Wed, 3 Jan 2018 11:47:30 +0100 Subject: [PATCH 1/2] Fixed BP constant issue in registration.php --- registration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registration.php b/registration.php index b97c5fdf..233b6fb7 100644 --- a/registration.php +++ b/registration.php @@ -9,5 +9,5 @@ \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::LIBRARY, 'Avalara_AvaTax', - BP . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'avalara' . DIRECTORY_SEPARATOR . 'avatax' + __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'avalara' . DIRECTORY_SEPARATOR . 'avatax' ); From 783416ab2789cc4bac0347cb85f9fb2ca76c6264 Mon Sep 17 00:00:00 2001 From: makao Date: Thu, 4 Jan 2018 10:19:51 +0100 Subject: [PATCH 2/2] Updated fix for BP constant, check if it is defined --- registration.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/registration.php b/registration.php index 233b6fb7..39ee93c9 100644 --- a/registration.php +++ b/registration.php @@ -6,8 +6,16 @@ __DIR__ ); +if (defined('BP')) { + // This path will work when extension is installed via composer or via manual installation + $vendorPath = BP . DIRECTORY_SEPARATOR . 'vendor'; +} else { + // This path will work when extension is being run in the context of integration tests, where BP is not defined + $vendorPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'; +} + \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::LIBRARY, 'Avalara_AvaTax', - __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'avalara' . DIRECTORY_SEPARATOR . 'avatax' + $vendorPath . DIRECTORY_SEPARATOR . 'avalara' . DIRECTORY_SEPARATOR . 'avatax' );