diff --git a/packages/Webkul/Shop/src/Http/Controllers/CartController.php b/packages/Webkul/Shop/src/Http/Controllers/CartController.php index d560d2df2..800fc1239 100755 --- a/packages/Webkul/Shop/src/Http/Controllers/CartController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/CartController.php @@ -93,6 +93,8 @@ class CartController extends Controller try { Event::fire('checkout.cart.add.before', $id); + dd(request()->except('_token')); + $result = Cart::add($id, request()->except('_token')); Event::fire('checkout.cart.add.after', $result); diff --git a/tests/Feature/Auth/AuthTest.php b/tests/Feature/Auth/AuthTest.php index 8d45066a9..22effd640 100644 --- a/tests/Feature/Auth/AuthTest.php +++ b/tests/Feature/Auth/AuthTest.php @@ -77,8 +77,49 @@ class AuthTest extends TestCase ]); $response->assertRedirect('/customer/account/profile'); - - $this->assertEquals(count([auth()->guard('customer')->user()]), 1); - } + + /** + * Test that customer cannot login with the wrong credentials. + */ + public function willNotLoginWithWrongCredentials() + { + $customers = app(Customer::class); + $customer = $customers->findOneByField('email', 'prashant@webkul.com'); + + $response = $this->from(route('login'))->post(route('customer.session.create'), + [ + 'email' => $customer->email, + 'password' => 'wrongpassword3428903mlndvsnljkvsd', + ]); + + $this->assertGuest(); + } + + /** + * Test to confirm that customer cannot login if user does not exist. + */ + public function willNotLoginWithNonexistingCustomer() + { + $response = $this->post(route('customer.session.create'), [ + 'email' => 'fiaiia9q2943jklq34h203qtb3o2@something.com', + 'password' => 'wrong-password', + ]); + + $this->assertGuest(); + } + + /** + * To test that customer can logout + */ + public function allowsCustomerToLogout() + { + $customer = auth()->guard('customer')->user(); + + dd('logout test', $customer); + + $this->get(route('customer.session.destroy')); + + $this->assertGuest(); + } } diff --git a/tests/Feature/CheckRegistrationPage.php b/tests/Feature/CheckRegistrationPage.php deleted file mode 100644 index 535325627..000000000 --- a/tests/Feature/CheckRegistrationPage.php +++ /dev/null @@ -1,20 +0,0 @@ -assertTrue(true); - } -} diff --git a/tests/Feature/Checkout/Cart/CheckCart.php b/tests/Feature/Checkout/Cart/CheckCart.php new file mode 100644 index 000000000..d1de7e249 --- /dev/null +++ b/tests/Feature/Checkout/Cart/CheckCart.php @@ -0,0 +1,37 @@ +