-
-
Notifications
You must be signed in to change notification settings - Fork 824
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] cleanup, more use of return in ActivityTest #20633
Conversation
(Standard links)
|
]; | ||
|
||
$this->callAPISuccess('Activity', 'create', $params); | ||
$this->callAPISuccessGetSingle('Activity', ['id' => $activity['id']]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test never actually does what it says on the box (ie it doesn't check the source) - which SyntaxConformance does
$this->assertEquals("custom string", $result['values'][0]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__); | ||
|
||
$this->assertEquals($this->test_activity_type_value, $result['values'][0]['activity_type_id']); | ||
$this->assertEquals('test activity type id', $result['values'][0]['subject']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear why these two lines are removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled out some of the stuff that is repeated in test after test due to apparent copy & paste
'id' => $result['id'], | ||
]); | ||
$this->assertEquals("custom string", $result['values'][$result['id']]['custom_' . $ids['custom_field_id']]); | ||
$this->assertEquals("2009-10-18 00:00:00", $result['values'][$result['id']]['activity_date_time']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this date one?
@@ -1218,28 +1206,27 @@ public function testActivityUpdateCheckCoreFields() { | |||
$params['assignee_contact_id'] = [$contact3 => $contact3]; | |||
$params['target_contact_id'] = [$contact4 => $contact4]; | |||
|
|||
$result = $this->callAPISuccess('activity', 'create', $params); | |||
|
|||
$this->assertEquals($activityId, $result['id'], ' in line ' . __LINE__); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - in this case - the call to activity create was removed by accident
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no - it was right to remove it - it's not doing an update - it's creating a random other activity that is not checked
@@ -1285,36 +1272,12 @@ public function testActivityUpdateWithStatus() { | |||
'activity_name' => 'Test activity type', | |||
]; | |||
|
|||
$result = $this->callAPISuccess('activity', 'create', $params); | |||
$this->assertEquals($result['id'], $activity['id']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one although params are backwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case just the redundant assert is removed
Ok thanks for the clarification. |
Overview
[NFC] [TEST] cleanup, more use of return in ActivityTest
Before
old
After
new
Technical Details
I removed some old patterns, added 'return' and removed some redundancy & a test that never actually tested anything
This is one of our earliest test suites & there is a lot in there that is a bit repetitive of this class and others
Comments