loyaltyAccountService = new LoyaltyAccountService(); } /** * @param LoyaltyAccountCreateResponse $createResponse * @param bool $expected * * @dataProvider proveUserInLpExistsProvider */ public function testProveUserInLpExists(LoyaltyAccountCreateResponse $createResponse, $expected) { self::assertEquals($expected, $this->loyaltyAccountService->proveUserInLpExists($createResponse)); } /** * @param LoyaltyAccountCreateResponse $createResponse * @param bool $expected * * @dataProvider proveNotUserInLpExistsProvider */ public function testNotProveUserInLpExists(LoyaltyAccountCreateResponse $createResponse, $expected) { self::assertEquals($expected, $this->loyaltyAccountService->proveUserInLpExists($createResponse)); } /** * @return array[] */ public function proveUserInLpExistsProvider() { $createResponse = new LoyaltyAccountCreateResponse(); $createResponse->success = false; $createResponse->errors = [ 'loyalty' => 'The customer is in this loyalty program already' ]; return [[ 'createResponse' => $createResponse, 'expected' => true ]]; } /** * @return array[] */ public function proveNotUserInLpExistsProvider() { $createResponse = new LoyaltyAccountCreateResponse(); $createResponse->success = false; $createResponse->errors = [ 'loyalty' => 'Some other failure' ]; return [[ 'createResponse' => $createResponse, 'expected' => false ]]; } }