crowdin / crowdin-api-client-php

PHP client library for Crowdin API
https://packagist.org/packages/crowdin/crowdin-api-client
MIT License
58 stars 31 forks source link

fix: Fix AbstractTestApi::mockRequest assertions #150

Closed pdelre closed 1 year ago

pdelre commented 1 year ago

This addresses the issues in AbstractTestApi::mockRequest assertions and resolves the missed issues with many unit tests. Primarily the tests themselves have issues where they pass in an array but mockRequest asserts against a json string. Additionally when a $params['response'] was unset, AbstractTestApi::mockRequest would return null which was causing PHP Notices that the GitHub Actions configuration was hiding.

There was one issue with AbstractApi::_delete that was detected with the fixed assertions where $params was being passed to Crowdin::apiRequest without being wrapped into a request $options.

Fixes #149

codecov[bot] commented 1 year ago

Codecov Report

Merging #150 (dab053d) into master (a53a35f) will increase coverage by 0.01%. Report is 1 commits behind head on master. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #150      +/-   ##
============================================
+ Coverage     90.41%   90.42%   +0.01%     
- Complexity     1181     1182       +1     
============================================
  Files           107      107              
  Lines          3076     3079       +3     
============================================
+ Hits           2781     2784       +3     
  Misses          295      295              
Files Coverage Δ
src/CrowdinApiClient/Api/AbstractApi.php 78.17% <100.00%> (+0.78%) :arrow_up:
andrii-bodnar commented 1 year ago

@pdelre awesome, thanks a lot for the contribution! 🚀