1
0
Fork 0
composer/tests/Composer/Test/Command/InitCommandTest.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2013-05-25 15:56:02 +00:00
<?php
2013-05-27 08:41:50 +00:00
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
2013-05-26 11:44:26 +00:00
namespace Composer\Test\Command;
2013-05-25 15:56:02 +00:00
use Composer\Command\InitCommand;
use Composer\Test\TestCase;
class InitCommandTest extends TestCase
{
function testParseValidAuthorString()
{
$command = new InitCommand;
2013-05-26 14:10:17 +00:00
$author = $command->parseAuthorString('John Smith <john@example.com>');
$this->assertEquals('John Smith', $author['name']);
$this->assertEquals('john@example.com', $author['email']);
2013-05-25 15:56:02 +00:00
}
2013-05-25 16:01:14 +00:00
function testParseEmptyAuthorString()
2013-05-25 15:56:02 +00:00
{
$command = new InitCommand;
$this->setExpectedException('InvalidArgumentException');
$command->parseAuthorString('');
}
2013-05-25 16:01:14 +00:00
function testParseAuthorStringWithInvalidEmail()
{
$command = new InitCommand;
$this->setExpectedException('InvalidArgumentException');
$command->parseAuthorString('John Smith <john>');
}
2013-05-25 15:56:02 +00:00
}