Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F10813654
NotificationsPayloadTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
NotificationsPayloadTest.php
View Options
<?php
namespace
Nasqueron\Notifications\Tests\Console\Commands
;
use
Nasqueron\Notifications\Console\Commands\NotificationsPayload
;
class
NotificationsPayloadTest
extends
TestCase
{
/**
* @var string
*/
protected
$class
=
'Nasqueron
\N
otifications
\C
onsole
\C
ommands
\N
otificationsPayload'
;
public
function
testRegularExecute
()
{
$path
=
__DIR__
.
'/../../data/payloads/DockerHubPushPayload.json'
;
$this
->
tester
->
execute
([
'command'
=>
$this
->
command
->
getName
(),
'service'
=>
'DockerHub'
,
'payload'
=>
$path
,
'args'
=>
[
'Acme'
,
'push'
],
]);
$this
->
assertContains
(
'"service": "DockerHub"'
,
$this
->
tester
->
getDisplay
());
$this
->
assertContains
(
'"project": "Acme"'
,
$this
->
tester
->
getDisplay
());
$this
->
assertContains
(
'svendowideit
\/
testhook'
,
$this
->
tester
->
getDisplay
());
}
public
function
testPhabricatorPayload
()
{
$path
=
__DIR__
.
'/../../data/payloads/PhabricatorPastePayload.json'
;
$this
->
tester
->
execute
([
'command'
=>
$this
->
command
->
getName
(),
'service'
=>
'Phabricator'
,
'payload'
=>
$path
,
'args'
=>
[
'Acme'
,
],
]);
$this
->
assertContains
(
'"service": "Phabricator"'
,
$this
->
tester
->
getDisplay
());
$this
->
assertContains
(
'"project": "Acme"'
,
$this
->
tester
->
getDisplay
());
$this
->
assertContains
(
'"type": "PSTE"'
,
$this
->
tester
->
getDisplay
());
}
/**
* @expectedException InvalidArgumentException
*/
public
function
testArgumentsArrayCombine
()
{
NotificationsPayload
::
argumentsArrayCombine
([
'foo'
],
[]);
}
public
function
testFileNotFound
()
{
$this
->
tester
->
execute
([
'command'
=>
$this
->
command
->
getName
(),
'service'
=>
'DockerHub'
,
'payload'
=>
"/tmp/not.found"
,
'args'
=>
[
'Acme'
,
'push'
],
]);
$this
->
assertContains
(
'File not found: /tmp/not.found'
,
$this
->
tester
->
getDisplay
()
);
}
public
function
testServiceNotFound
()
{
$path
=
__DIR__
.
'/../../data/payloads/DockerHubPushPayload.json'
;
$this
->
tester
->
execute
([
'command'
=>
$this
->
command
->
getName
(),
'service'
=>
'InterdimensionalTeleport'
,
'payload'
=>
$path
,
'args'
=>
[
'Acme'
,
'push'
],
]);
$this
->
assertContains
(
'Unknown service: InterdimensionalTeleport'
,
$this
->
tester
->
getDisplay
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jul 29, 13:57 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2790052
Default Alt Text
NotificationsPayloadTest.php (2 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment