If a message is explicitly processed via provider::incoming or provider::send, you should not expect to have to set the direction on the passed message object.

Each of these provider methods should set the direction.

provider::queue should throw an exception before pre-process events if it is missing a direction.

Checking for direction prevents an issue where subscriber events assume direction to be set, but are missing the direction when processed via these method.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dpi created an issue. See original summary.

dpi’s picture

Issue summary: View changes
dpi’s picture

Issue summary: View changes
almaudoh’s picture

+1, right now I have queued messages which are throwing Exceptions because I forgot to set the direction before testing. This should actually be an Assert not an Exception since it's not expected to be a coding omission if the direction is not set.

dpi’s picture

Issue tags: +release-8.x-1.0-beta2

added release-8.x-1.0-beta2 tag.

dpi’s picture

Status: Active » Needs review
FileSize
7.1 KB

https://github.com/dpi/smsframework/pull/65

  • Set direction automatically if message passed to provider::send or provider::incoming.
  • Throw exception if missing direction when passing messages to provider::queue
  • Added new exception: \Drupal\sms\Exception\SmsDirectionException

  • dpi committed 5a61ceb on 8.x-1.x
    Issue #2832618 by dpi: Ensure directions are set for messages passed...
dpi’s picture

Status: Needs review » Fixed

Committed since there's test coverage, let me know if you spot any omissions.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.