assertTrue(SingleOptin::setStatus(static::$customer->email, true)); } public function testCreateSingleOptinShouldFailBecauseCustomerExists() { $this->expectException(ApiErrorException::class); $this->expectExceptionMessage(ApiError::singleOptinCustomerExists()->label); $customer = new Customer(); $customer->firstname = 'toto singleoptin'; $customer->lastname = 'delarogerie'; $customer->email = 'totosingleoptin.delarogerie@gmail.com'; $customer->password = 'Complic4tEd!P4assW0rd'; $customer->birth_date = '1992-03-08'; $customer->phone = '0673891160'; $customer->address = 'rue des totos'; $customer->city = 'Toto ville'; $customer->postcode = '72160'; $customer->country = Country::france(); $this->assertTrue($customer->save()); $this->assertFalse(SingleOptin::setStatus($customer->email, true)); } }