-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support JB customer pricing module, drop support for Mageplaza (#6)
* Support JB customer pricing module, drop support for Mageplaza better tier pricing * Upgrade guide
- Loading branch information
1 parent
f59972e
commit 4c4330d
Showing
8 changed files
with
104 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Upgrading from 1.x to 2.x | ||
|
||
You do not need to modify code in your price/sku retriever. | ||
|
||
If you were using the Mageplaza Better Tier Price module you now have to implement your update class yourself or upgrade to the [JustBetter Magento 2 Customer Pricing](https://github.com/justbetter/magento2-customer-pricing) module. | ||
See the readme on how you can implement your own updater class, you can use the default class from version 1.x as a template. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Tests"> | ||
<directory>./tests/*</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</coverage> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true"> | ||
<testsuites> | ||
<testsuite name="Tests"> | ||
<directory>./tests/*</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage/> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace JustBetter\MagentoCustomerPrices\Tests\Actions; | ||
|
||
use Illuminate\Http\Client\Request; | ||
use Illuminate\Http\Client\RequestException; | ||
use Illuminate\Support\Facades\Http; | ||
use JustBetter\MagentoCustomerPrices\Actions\UpdateCustomerPrices; | ||
use JustBetter\MagentoCustomerPrices\Models\MagentoCustomerPrice; | ||
use JustBetter\MagentoCustomerPrices\Tests\TestCase; | ||
|
||
class UpdateCustomerPricesTest extends TestCase | ||
{ | ||
public UpdateCustomerPrices $action; | ||
|
||
public MagentoCustomerPrice $model; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->action = app(UpdateCustomerPrices::class); | ||
$this->model = MagentoCustomerPrice::create([ | ||
'sku' => '::sku::', | ||
'prices' => [ | ||
[ | ||
'sku' => '13901952', 'price' => '40.52000000', 'storeId' => 0, 'quantity' => 1, 'customerId' => 1, | ||
], | ||
], | ||
]); | ||
} | ||
|
||
public function test_it_updates_price(): void | ||
{ | ||
Http::fake([ | ||
'*customer-pricing*' => Http::response([ | ||
'firstname' => '::firstname::', | ||
'lastname' => '::lastname::', | ||
]), | ||
'*products/::sku::' => Http::response(), | ||
]); | ||
|
||
$this->action->update($this->model); | ||
|
||
Http::assertSent(function (Request $request) { | ||
return $request->data() === [ | ||
'customerPrices' => [ | ||
[ | ||
'customer_id' => 1, | ||
'quantity' => 1, | ||
'price' => 40.52, | ||
], | ||
], | ||
]; | ||
}); | ||
} | ||
|
||
public function test_it_throws_error_on_fail(): void | ||
{ | ||
Http::fake([ | ||
'*customer-pricing*' => Http::response('::error::', 500), | ||
]); | ||
|
||
$this->expectException(RequestException::class); | ||
|
||
$this->action->update($this->model); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.