Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56388107
NotificationsPayloadTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
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
Sat, Nov 7, 17:05 (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3919098
Default Alt Text
NotificationsPayloadTest.php (2 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment