Skip to content

Commit f55446c

Browse files
committed
add more tests
1 parent d19b24f commit f55446c

15 files changed

+642
-21
lines changed

database/factories/OrderFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ public function closed(): static
189189
]);
190190
}
191191

192-
193192
/**
194193
* Create a failed order.
195194
*

phpunit.ci.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</testsuite>
2626
<testsuite name="Webshop">
2727
<directory suffix="Test.php">./tests/Webshop</directory>
28-
<exclude>./tests/Webshop/BaseCheckoutControllerTest.php</exclude>
28+
<exclude>./tests/Webshop/Checkout/BaseCheckoutControllerTest.php</exclude>
2929
</testsuite>
3030
</testsuites>
3131
<extensions>

phpunit.pgsql.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</testsuite>
2626
<testsuite name="Webshop">
2727
<directory suffix="Test.php">./tests/Webshop</directory>
28-
<exclude>./tests/Webshop/BaseCheckoutControllerTest.php</exclude>
28+
<exclude>./tests/Webshop/Checkout/BaseCheckoutControllerTest.php</exclude>
2929
</testsuite>
3030
</testsuites>
3131
<extensions>

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</testsuite>
2626
<testsuite name="Webshop">
2727
<directory suffix="Test.php">./tests/Webshop</directory>
28-
<exclude>./tests/Webshop/BaseCheckoutControllerTest.php</exclude>
28+
<exclude>./tests/Webshop/Checkout/BaseCheckoutControllerTest.php</exclude>
2929
</testsuite>
3030
</testsuites>
3131
<extensions>

tests/Webshop/BaseCheckoutControllerTest.php renamed to tests/Webshop/Checkout/BaseCheckoutControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @noinspection PhpUnhandledExceptionInspection
1717
*/
1818

19-
namespace Tests\Webshop;
19+
namespace Tests\Webshop\Checkout;
2020

2121
use App\Contracts\Http\Requests\RequestAttribute;
2222
use App\Models\Order;

tests/Webshop/CheckoutControllerTest.php renamed to tests/Webshop/Checkout/CheckoutControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @noinspection PhpUnhandledExceptionInspection
1717
*/
1818

19-
namespace Tests\Webshop;
19+
namespace Tests\Webshop\Checkout;
2020

2121
use Tests\Feature_v2\Base\BaseApiWithDataTest;
2222
use Tests\Traits\RequireSE;

tests/Webshop/CheckoutCreateSessionControllerTest.php renamed to tests/Webshop/Checkout/CheckoutCreateSessionControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @noinspection PhpUnhandledExceptionInspection
1717
*/
1818

19-
namespace Tests\Webshop;
19+
namespace Tests\Webshop\Checkout;
2020

2121
use App\Contracts\Http\Requests\RequestAttribute;
2222
use App\Enum\OmnipayProviderType;

tests/Webshop/CheckoutFinalizeOrCancelControllerTest.php renamed to tests/Webshop/Checkout/CheckoutFinalizeOrCancelControllerTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
* @noinspection PhpUnhandledExceptionInspection
1717
*/
1818

19-
namespace Tests\Webshop;
19+
namespace Tests\Webshop\Checkout;
2020

2121
use App\Enum\OmnipayProviderType;
2222
use App\Enum\PaymentStatusType;
23+
use Illuminate\Support\Facades\Session;
2324
use Illuminate\Support\Str;
2425

2526
/**
@@ -52,7 +53,7 @@ public function testFinalizePaymentSuccess(): void
5253

5354
$this->assertDatabaseHas('orders', ['transaction_id' => $transaction_id, 'status' => PaymentStatusType::PROCESSING->value]);
5455

55-
$response = $this->getJsonWithData('Shop/Checkout/Finalize/' . $provider . '/' . $transaction_id, [
56+
Session::put('processing', [
5657
'payment_id' => 'dummy-payment-123',
5758
'status' => 'completed',
5859
'transactionReference' => $this->test_order->transaction_id,
@@ -64,6 +65,8 @@ public function testFinalizePaymentSuccess(): void
6465
],
6566
]);
6667

68+
$response = $this->getJsonWithData('Shop/Checkout/Finalize/' . $provider . '/' . $transaction_id);
69+
6770
$this->assertOk($response);
6871
$response->assertJsonStructure([
6972
'is_success',
@@ -224,7 +227,7 @@ public function testTransactionIdGeneration(): void
224227
$provider = OmnipayProviderType::DUMMY->value;
225228
$transaction_id = $this->test_order->transaction_id;
226229

227-
$response = $this->getJsonWithData('Shop/Checkout/Finalize/' . $provider . '/' . $transaction_id, [
230+
Session::put('processing', [
228231
'payment_id' => 'dummy-payment-123',
229232
'status' => 'completed',
230233
'transactionReference' => $this->test_order->transaction_id,
@@ -236,6 +239,8 @@ public function testTransactionIdGeneration(): void
236239
],
237240
]);
238241

242+
$response = $this->getJsonWithData('Shop/Checkout/Finalize/' . $provider . '/' . $transaction_id);
243+
239244
$this->assertOk($response);
240245
$response->assertJson([
241246
'is_success' => true,

tests/Webshop/CheckoutOfflineControllerTest.php renamed to tests/Webshop/Checkout/CheckoutOfflineControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @noinspection PhpUnhandledExceptionInspection
1717
*/
1818

19-
namespace Tests\Webshop;
19+
namespace Tests\Webshop\Checkout;
2020

2121
use App\Contracts\Http\Requests\RequestAttribute;
2222
use App\Enum\PaymentStatusType;

tests/Webshop/CheckoutProcessPaymentControllerTest.php renamed to tests/Webshop/Checkout/CheckoutProcessPaymentControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @noinspection PhpUnhandledExceptionInspection
1717
*/
1818

19-
namespace Tests\Webshop;
19+
namespace Tests\Webshop\Checkout;
2020

2121
use App\Enum\OmnipayProviderType;
2222
use App\Enum\PaymentStatusType;

0 commit comments

Comments
 (0)