-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathUbuntuNotifier.php
More file actions
47 lines (38 loc) · 1.41 KB
/
Copy pathUbuntuNotifier.php
File metadata and controls
47 lines (38 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Codeception\Extension;
use Namshi\Notificator\Notification\Handler\NotifySend as NotifySendHandler;
use Namshi\Notificator\Manager;
use Namshi\Notificator\Notification\NotifySend\NotifySendNotification;
use Symfony\Component\Process\ExecutableFinder;
class UbuntuNotifier extends \Codeception\Platform\Extension {
static $events = array('result.print.after' => 'notify');
function notify($event)
{
$result = $event->getResult();
$manager = new Manager();
$manager->addHandler(new NotifySendHandler(new ExecutableFinder()));
$icon = '/usr/share/icons/gnome/48x48/emotes/';
if ($result->errorCount() > 0) {
$icon .= 'face-angry';
} else if ($result->failureCount() > 0 ) {
$icon .= 'face-sad';
} else {
$icon .= 'face-cool';
}
$icon .= '.png';
$notification = new NotifySendNotification(
"\"Codeception Tests results: ".
$result->count(). " test where ".
$result->failureCount()." failed, ".
$result->errorCount()." errors, ".
$result->skippedCount()." skyped, ".
$result->notImplementedCount()." not implemented.\"",
[
'--urgency' => 'low',
'--category' => 'testing',
'--icon' => $icon
]
);
$manager->trigger($notification);
}
}