Skip to content

Commit

Permalink
Upgrade PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Jan 2, 2018
1 parent 4b2c9fe commit eda9243
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -35,7 +35,7 @@
"symfony/yaml": "~2.7|~3.0"
},
"require-dev": {
"phpunit/phpunit": "~6.1",
"phpunit/phpunit": "^6.4.3",
"symfony/finder": "~2.7|~3.0"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions test/src/DeployerTest.php
Expand Up @@ -53,10 +53,11 @@ public function testCollections($collection)
}

/**
* @expectedException \InvalidArgumentException
*/
public function testCollectionsE()
{
$this->expectException(\InvalidArgumentException::class);

$this->deployer->some_collection;
}

Expand Down Expand Up @@ -107,11 +108,12 @@ public function testAddDefault()
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Configuration parameter `config` isn't array.
*/
public function testAddDefaultToNotArray()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Configuration parameter `config` isn\'t array.');

Deployer::setDefault('config', 'option');
Deployer::addDefault('config', ['three']);
}
Expand Down
6 changes: 4 additions & 2 deletions test/src/Host/HostSelectorTest.php
Expand Up @@ -21,10 +21,11 @@ public function testCanBeCreatedFromEmptyHostCollection()
}

/**
* @expectedException Exception
*/
public function testThrowExceptionIfStageOrHostnameNotFound()
{
$this->expectException(\Exception::class);

$hostSelector = new HostSelector(new HostCollection());
$hostSelector->getHosts('ThisHostDoNotExists');
}
Expand Down Expand Up @@ -76,10 +77,11 @@ public function testReturnCorrectSizeOfHostsArray()
}

/**
* @expectedException Exception
*/
public function testShouldThrowExceptionIfHostNameOrStageNotFound()
{
$this->expectException(\Exception::class);

$host = new Host('app');
$hostCollection = new HostCollection();
$hostCollection->set('app', $host);
Expand Down
5 changes: 3 additions & 2 deletions test/src/Initiaizer/InitializerTest.php
Expand Up @@ -70,11 +70,12 @@ public function tearDown()
/**
* Test with template not found
*
* @expectedException \Deployer\Initializer\Exception\TemplateNotFoundException
* @expectedExceptionMessage Not found template with name "foo". Available templates: "test"
*/
public function testWithTemplateNotFound()
{
$this->expectException(\Deployer\Initializer\Exception\TemplateNotFoundException::class);
$this->expectExceptionMessage('Not found template with name "foo". Available templates: "test"');

$this->initializer->initialize('foo', sys_get_temp_dir(), 'deploy.php');
}

Expand Down
3 changes: 2 additions & 1 deletion test/src/Task/GroupTaskTest.php
Expand Up @@ -12,10 +12,11 @@
class GroupTaskTest extends TestCase
{
/**
* @expectedException \RuntimeException
*/
public function testGroupTask()
{
$this->expectException(\RuntimeException::class);

$context = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();

$task = new GroupTask('group', []);
Expand Down
6 changes: 4 additions & 2 deletions test/src/Task/ScriptManagerTest.php
Expand Up @@ -23,19 +23,21 @@ public function testConstructorReturnsScriptManagerInstance()
}

/**
* @expectedException InvalidArgumentException
*/
public function testThrowsExceptionIfTaskCollectionEmpty()
{
$this->expectException(\InvalidArgumentException::class);

$scriptManager = new ScriptManager(new TaskCollection());
$scriptManager->getTasks("");
}

/**
* @expectedException InvalidArgumentException
*/
public function testThrowsExceptionIfTaskDontExists()
{
$this->expectException(\InvalidArgumentException::class);

$taskCollection = new TaskCollection();
$taskCollection->set('testTask', new Task('testTask'));

Expand Down

0 comments on commit eda9243

Please sign in to comment.