From a472e827683bdb9511c2aaceb00f52fdda96307b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Thu, 12 Aug 2021 08:39:51 +0200 Subject: [PATCH] Customer login test --- tests/Feature/ApiV2/CustomerTest.php | 2 +- tests/Unit/CrmClientV2CustomerTest.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/Feature/ApiV2/CustomerTest.php b/tests/Feature/ApiV2/CustomerTest.php index a22204d..2fc930a 100644 --- a/tests/Feature/ApiV2/CustomerTest.php +++ b/tests/Feature/ApiV2/CustomerTest.php @@ -42,7 +42,7 @@ class CustomerTest extends ApiBase $response = $this->callApiWithToken( $service, 'post', - route('apiV2.customers.authenticate', ['customer' => $info->hashcode]), + route('apiV2.customers.authenticate', []), [ 'email' => $customer->email, 'password' => 'testPassword' diff --git a/tests/Unit/CrmClientV2CustomerTest.php b/tests/Unit/CrmClientV2CustomerTest.php index f2a2c9a..4ed021a 100644 --- a/tests/Unit/CrmClientV2CustomerTest.php +++ b/tests/Unit/CrmClientV2CustomerTest.php @@ -227,6 +227,17 @@ class CrmClientV2CustomerTest extends CrmClientTester $this->assertEquals(null, $customer->password); } + + public function testCustomerLogin() + { + $api = new CrmApiV2(); + $customer = $api->getCustomerOrNew('toto.delarogerie@gmail.com'); + $this->assertTrue($customer->activate()); + $this->assertTrue($customer->status); + + $this->assertTrue(Customer::login($customer->email, 'Complic4tEd!P4assW0rd')); + } + public function testCustomerStorePropsFails() { $this->expectException(ValidationException::class);