Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC] {test} code cleanup in test class #20389

Merged
merged 1 commit into from
May 24, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented May 24, 2021

Overview

[NFC] {test} code cleanup in test class

Before

Loads of bad practice

After

IDE mental state much improved

Technical Details

Comments

@civibot
Copy link

civibot bot commented May 24, 2021

(Standard links)

@civibot civibot bot added the master label May 24, 2021
@eileenmcnaughton eileenmcnaughton changed the title [NFC] {test} minor cleanup [NFC] {test} code cleanup in test class May 24, 2021
@@ -236,7 +239,6 @@ public function testCreateCheckContribution() {
$params['amount_level'] = 'Unreasonable';
$params['cancel_reason'] = 'You lose sucker';
$params['creditnote_id'] = 'sudo rm -rf';
$params['tax_amount'] = '1';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed because the test operates with tax disabled so it is not valid to have a tax_amount for this contribution

public function testCreateContributionSourceInvalidContContact() {

$params = [
'contribution_contact_id' => 999,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have adequate cover for using an invalid contact id in syntax conformance - in general these failure tests have been rationalised from the early days

public function testDeleteParamsNotArrayContribution() {
$this->expectException(TypeError::class);
$params = 'contribution_id= 1';
$contribution = $this->callAPIFailure('contribution', 'delete', $params);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is adequately covered in syntax conformance & with array typing

@seamuslee001
Copy link
Contributor

@eileenmcnaughton

<!--StartFragment-->
ContributionTest.php:4836, IncorrectTypeHint, Priority: High
--
Expected type hint "int"; found "?int" for $objectId

<!--EndFragment-->

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 I think that is already fixed

@seamuslee001 seamuslee001 merged commit a0203d5 into civicrm:master May 24, 2021
@seamuslee001 seamuslee001 deleted the tax branch May 24, 2021 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants