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

Change warning to logger for GSM-7 #382

Merged
merged 7 commits into from Mar 3, 2023

Conversation

SecondeJK
Copy link
Contributor

@SecondeJK SecondeJK commented Mar 3, 2023

We've been through several implementations of this, and I think we're at a final one for the behaviour of sending an SMS that can be used by frameworks effectively.

Description

If you have chosen to set your SMS as unicode, it will no longer issue a warning if it contains a GSM-7 charset: you have explicitly told the code that you want to send it as unicode because it is not the default.

If you are sending a message that should be in unicode, but have not changed the type, a log warning will be fired if you have set a logger up for the library. We don't want to stop you sending the message - it might be garbled, but it's your choice to send it this way if you wish. To prevent this, make sure to use the isGsm7 static method on the SMS object.

Motivation and Context

Trying to get the best user experience we can (and it's hard)

How Has This Been Tested?

One test deleted, the other changed to use prophecy to test the call to the logger.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-commenter
Copy link

codecov-commenter commented Mar 3, 2023

Codecov Report

Merging #382 (c1ae14a) into main (7735ca5) will decrease coverage by 0.06%.
The diff coverage is 20.58%.

@@             Coverage Diff              @@
##               main     #382      +/-   ##
============================================
- Coverage     78.31%   78.26%   -0.06%     
- Complexity     1818     1820       +2     
============================================
  Files           172      172              
  Lines          4875     4872       -3     
============================================
- Hits           3818     3813       -5     
- Misses         1057     1059       +2     
Impacted Files Coverage Δ
src/Client.php 21.56% <0.00%> (+0.81%) ⬆️
src/SMS/Message/Binary.php 89.47% <0.00%> (-10.53%) ⬇️
src/SMS/Message/Vcal.php 80.00% <0.00%> (-20.00%) ⬇️
src/SMS/Message/Vcard.php 80.00% <0.00%> (-20.00%) ⬇️
src/SMS/Message/WAPPush.php 88.88% <0.00%> (-11.12%) ⬇️
src/SMS/Message/OutboundMessage.php 97.05% <50.00%> (ø)
src/SMS/Message/SMS.php 94.59% <75.00%> (-5.41%) ⬇️
src/SMS/Client.php 90.47% <100.00%> (-0.83%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

test/SMS/ClientTest.php Outdated Show resolved Hide resolved
Copy link
Contributor

@dragonmantank dragonmantank left a comment

Choose a reason for hiding this comment

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

Small text change with the error message to be more clear (since it's not really unicode vs ASCII but GSM7 characters)

Couple of places we can tighten up code, and a few other questions

test/SMS/ClientTest.php Outdated Show resolved Hide resolved
rector.php Show resolved Hide resolved
src/Client.php Show resolved Hide resolved
src/Client.php Show resolved Hide resolved
src/SMS/Client.php Show resolved Hide resolved
src/SMS/Message/OutboundMessage.php Show resolved Hide resolved
src/SMS/Message/Vcal.php Outdated Show resolved Hide resolved
src/SMS/Message/Vcard.php Outdated Show resolved Hide resolved
src/SMS/Message/WAPPush.php Outdated Show resolved Hide resolved
test/SMS/ClientTest.php Outdated Show resolved Hide resolved
SecondeJK and others added 3 commits March 3, 2023 16:08
Co-authored-by: Chris Tankersley <chris@ctankersley.com>
Copy link
Contributor

@dragonmantank dragonmantank left a comment

Choose a reason for hiding this comment

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

LGTM

@SecondeJK SecondeJK merged commit 24a1c6d into main Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants