Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade PHPUnit #1417

Merged
merged 6 commits into from Jan 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.

12 changes: 5 additions & 7 deletions test/src/DeployerTest.php
Expand Up @@ -52,11 +52,10 @@ public function testCollections($collection)
$this->assertInstanceOf(CollectionInterface::class, $this->deployer->{$collection});
}

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

$this->deployer->some_collection;
}

Expand Down Expand Up @@ -106,12 +105,11 @@ public function testAddDefault()
$this->assertEquals($expected, Deployer::getDefault('config'));
}

/**
* @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
10 changes: 4 additions & 6 deletions test/src/Host/HostSelectorTest.php
Expand Up @@ -20,11 +20,10 @@ public function testCanBeCreatedFromEmptyHostCollection()
$this->assertInstanceOf($classname, $hostSelector);
}

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

$hostSelector = new HostSelector(new HostCollection());
$hostSelector->getHosts('ThisHostDoNotExists');
}
Expand Down Expand Up @@ -75,11 +74,10 @@ public function testReturnCorrectSizeOfHostsArray()
$this->assertSame(count($hosts), 100);
}

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

$host = new Host('app');
$hostCollection = new HostCollection();
$hostCollection->set('app', $host);
Expand Down
6 changes: 3 additions & 3 deletions test/src/Initiaizer/InitializerTest.php
Expand Up @@ -69,12 +69,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
5 changes: 2 additions & 3 deletions test/src/Task/GroupTaskTest.php
Expand Up @@ -11,11 +11,10 @@

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
10 changes: 4 additions & 6 deletions test/src/Task/ScriptManagerTest.php
Expand Up @@ -22,20 +22,18 @@ public function testConstructorReturnsScriptManagerInstance()
$this->assertInstanceOf($classname, $scriptManager);
}

/**
* @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