Skip to content

Commit

Permalink
Bug: Silent Dead if webhook url missing (#13)
Browse files Browse the repository at this point in the history
* Correct Indentation

* Add Exception if webhook is missing

Co-authored-by: Danny Linden <[email protected]>
  • Loading branch information
dannylinden and Danny Linden authored Mar 26, 2020
1 parent 6e85572 commit f0d5ab2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,43 @@ Enable and configure the extension in your `codeception.yaml`
extensions:
enabled:
- Codeception\Extension\SlackExtension
config:
Codeception\Extension\SlackExtension:
webhook: https://hooks.slack.com/services/...
config:
Codeception\Extension\SlackExtension:
webhook: https://hooks.slack.com/services/...
**Advanced** usage:

extensions:
enabled:
- Codeception\Extension\SlackExtension
config:
enabled:
- Codeception\Extension\SlackExtension
config:
Codeception\Extension\SlackExtension:
webhook: https://hooks.slack.com/services/...
webhook: https://hooks.slack.com/services/...
# possible notification strategies: always|successonly|failonly|failandrecover|statuschange
strategy: always
# possible notification strategies: always|successonly|failonly|failandrecover|statuschange
strategy: always
# If 'true' details about failed tests will be displayed. Default value: 'false'
extended: true
# If 'true' details about failed tests will be displayed. Default value: 'false'
extended: true
# Limit the size of error messages in extended mode. 0 = unlimited. Default value: 80
extendedMaxLength: 80
# Limit the size of error messages in extended mode. 0 = unlimited. Default value: 80
extendedMaxLength: 80
# Limit the amount of reported errors in extended mode. 0 = unlimited. Default value: 0
extendedMaxErrors: 10
# Limit the amount of reported errors in extended mode. 0 = unlimited. Default value: 0
extendedMaxErrors: 10
# customize your message with additional prefix and/or suffix
# customize your message with additional prefix and/or suffix
messagePrefix: '*Smoke-Test*'
messageSuffix: <http://my-ci/my-job|Link>
messageSuffixOnFail: <!channel>
messagePrefix: '*Smoke-Test*'
messageSuffix: <http://my-ci/my-job|Link>
messageSuffixOnFail: <!channel>
# optional config keys that will overwrite the default configuration of the webhook
# optional config keys that will overwrite the default configuration of the webhook
channel: '#any-channel,@any-user'
channelOnFail: '#any-channel,@any-user'
username: CI
icon: :ghost:
channel: '#any-channel,@any-user'
channelOnFail: '#any-channel,@any-user'
username: CI
icon: :ghost:
Example
-----
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/SlackExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class SlackExtension extends Extension
public function _initialize()
{
if (!isset($this->config['webhook']) or empty($this->config['webhook'])) {
return;
throw new ExtensionException($this, "configuration for 'webhook' is missing");
}

$this->client = new Client($this->config['webhook']);
Expand Down

0 comments on commit f0d5ab2

Please sign in to comment.