Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56318253
TriggerBuildFactoryTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
TriggerBuildFactoryTest.php
View Options
<?php
namespace
Keruald\DockerHub\Tests\Build
;
use
Keruald\DockerHub\DockerHubImage
;
use
Keruald\DockerHub\Build\TriggerBuild
;
use
Keruald\DockerHub\Build\TriggerBuildFactory
;
use
Keruald\DockerHub\Tests\WithMockHttpClient
;
class
TriggerBuildFactoryTest
extends
\PHPUnit_Framework_TestCase
{
use
WithMockHttpClient
;
/**
* @var Keruald\DockerHub\Build\TriggerBuildFactory
*/
protected
$factory
;
public
function
setUp
()
{
$client
=
self
::
mockHttpClient
();
$tokens
=
self
::
mockTokens
();
$this
->
factory
=
new
TriggerBuildFactory
(
$client
,
$tokens
);
}
/**
* @return array
*/
private
static
function
mockTokens
()
{
return
[
"acme/foo"
=>
"0000"
,
];
}
public
function
testGetForImage
()
{
$this
->
assertInstanceOf
(
TriggerBuild
::
class
,
$this
->
factory
->
getForImage
(
"acme/foo"
)
);
}
/**
* @expectedException \InvalidArgumentException
*/
public
function
testGetForImageWithoutToken
()
{
$this
->
factory
->
getForImage
(
"acme/bar"
);
}
public
function
testBuild
()
{
// That returns void.
// We don't need to test the sendPayloadForAll method.
// So, we only need to check there is no exception or error.
$this
->
factory
->
build
(
"acme/foo"
);
}
public
function
testHasToken
()
{
$this
->
assertTrue
(
$this
->
factory
->
hasToken
(
"acme/foo"
));
}
public
function
testHasTokenWhenWeDoNot
()
{
$this
->
assertFalse
(
$this
->
factory
->
hasToken
(
"acme/bar"
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 6, 23:47 (11 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4249070
Default Alt Text
TriggerBuildFactoryTest.php (1 KB)
Attached To
Mode
rKDOCKERHUB Keruald Docker Hub
Attached
Detach File
Event Timeline
Log In to Comment