-
Notifications
You must be signed in to change notification settings - Fork 206
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
Fix Analytics report test cases #2436
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace WeDevs\Dokan\Test\Analytics\Reports; | ||
|
||
use WeDevs\Dokan\Commission; | ||
use WeDevs\Dokan\Test\DokanTestCase; | ||
|
||
/** | ||
|
@@ -100,14 +101,19 @@ public static function get_dokan_stats_data() { | |
[ | ||
[ | ||
'vendor_earning' => random_int( 5, 10 ), | ||
'vendor_gateway_fee' => random_int( 5, 10 ), | ||
'vendor_discount' => random_int( 5, 10 ), | ||
// 'vendor_gateway_fee' => random_int( 5, 10 ), | ||
// 'vendor_discount' => random_int( 5, 10 ), | ||
'admin_commission' => random_int( 5, 10 ), | ||
'admin_gateway_fee' => random_int( 5, 10 ), | ||
'admin_discount' => random_int( 5, 10 ), | ||
'admin_subsidy' => random_int( 5, 10 ), | ||
// 'admin_gateway_fee' => random_int( 5, 10 ), | ||
// 'admin_discount' => random_int( 5, 10 ), | ||
// 'admin_subsidy' => random_int( 5, 10 ), | ||
Comment on lines
+104
to
+109
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Keep the commented metrics in test data The commented-out metrics (
These metrics should remain in the test data to ensure proper test coverage of the analytics and reporting features. 🔗 Analysis chainVerify the intentional removal of financial metrics Several financial metrics have been commented out without replacement:
Please confirm if this is intentional and whether these metrics are no longer needed in the test data. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check if these metrics are still used in other test files or main code
rg -l "(vendor|admin)_(gateway_fee|discount|subsidy)" --type php
Length of output: 335 Script: #!/bin/bash
# Check the actual usage of these metrics in the related files
rg "(vendor|admin)_(gateway_fee|discount|subsidy)" --type php -C 2
Length of output: 6386 |
||
], | ||
], | ||
]; | ||
} | ||
|
||
public function tear_down() { | ||
dokan()->get_container()->extend( 'commission' )->setConcrete( new Commission() ); | ||
parent::tear_down(); | ||
} | ||
} |
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.
🛠️ Refactor suggestion
Fix leading commas to prevent SQL syntax errors
The variables
$commission
and$vendor_earning
start with leading commas. When these are concatenated into the$clauses[]
array, it results in extra commas in the SQL query, which can cause syntax errors.Apply the following diff to remove the leading commas from the variable definitions:
Additionally, ensure that commas are correctly placed when adding these variables to the clauses:
This adjustment will prevent extra commas in the SQL query and ensure proper syntax.
📝 Committable suggestion