diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-02-12 02:16:05 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-02-12 02:16:05 +0400 |
commit | 531b3576382e3ebefe1b8a645533ea642b9dbd3d (patch) | |
tree | ab69599914f652d646171668d80685b97d920a0d /tests | |
parent | fc57db82a5b6030c2031b9aeea8e190182fa2a8f (diff) |
refs #4610 some code tweaks and optimizations
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PHPUnit/Core/CliMulti/OutputTest.php | 8 | ||||
-rw-r--r-- | tests/PHPUnit/Core/CliMulti/ProcessTest.php | 8 | ||||
-rw-r--r-- | tests/PHPUnit/Core/UrlTest.php | 19 |
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/PHPUnit/Core/CliMulti/OutputTest.php b/tests/PHPUnit/Core/CliMulti/OutputTest.php index ae12693711..e7128b91c2 100644 --- a/tests/PHPUnit/Core/CliMulti/OutputTest.php +++ b/tests/PHPUnit/Core/CliMulti/OutputTest.php @@ -43,6 +43,14 @@ class OutputTest extends PHPUnit_Framework_TestCase $this->assertFalse($this->output->exists()); } + public function test_getPathToFile_shouldReturnFullPath() + { + $expectedEnd = '/tmp/climulti/myid.output'; + + $this->assertStringEndsWith($expectedEnd, $this->output->getPathToFile()); + $this->assertGreaterThan(strlen($expectedEnd), strlen($this->output->getPathToFile())); + } + public function test_exists_ShouldReturnTrue_IfSomethingIsWritten() { $this->output->write('test'); diff --git a/tests/PHPUnit/Core/CliMulti/ProcessTest.php b/tests/PHPUnit/Core/CliMulti/ProcessTest.php index 540c210395..2c4b02ee2e 100644 --- a/tests/PHPUnit/Core/CliMulti/ProcessTest.php +++ b/tests/PHPUnit/Core/CliMulti/ProcessTest.php @@ -84,6 +84,14 @@ class ProcessTest extends PHPUnit_Framework_TestCase $this->assertTrue($this->process->hasFinished()); } + public function test_hasStarted() + { + $this->assertTrue($this->process->hasStarted(false)); + $this->assertTrue($this->process->hasStarted('6341')); + + $this->assertFalse($this->process->hasStarted('')); + } + public function test_isSupported() { $this->assertTrue(Process::isSupported(), 'This test does not work on windows or if the commands ps and awk are not available'); diff --git a/tests/PHPUnit/Core/UrlTest.php b/tests/PHPUnit/Core/UrlTest.php index 55651c4dcf..fc6c9cea33 100644 --- a/tests/PHPUnit/Core/UrlTest.php +++ b/tests/PHPUnit/Core/UrlTest.php @@ -280,5 +280,24 @@ class UrlTest extends PHPUnit_Framework_TestCase ); } + public function test_getQueryFromUrl_ShouldReturnEmtpyString_IfNoQuery() + { + $this->assertEquals('', Url::getQueryFromUrl('', array())); + $this->assertEquals('', Url::getQueryFromUrl(null, array())); + $this->assertEquals('', Url::getQueryFromUrl('http://localhost/path', array())); + } + + public function test_getQueryFromUrl_ShouldReturnOnlyTheQueryPartOfTheUrl_IfNoAdditionalParamsGiven() + { + $this->assertEquals('foo=bar&foo2=bar2&test[]=1', Url::getQueryFromUrl('http://example.com/?foo=bar&foo2=bar2&test[]=1', array())); + $this->assertEquals('foo=bar&foo2=bar2&test[]=1', Url::getQueryFromUrl('/?foo=bar&foo2=bar2&test[]=1', array())); + } + + public function test_getQueryFromUrl_ShouldAddAdditionalParams_IfGiven() + { + $this->assertEquals('foo=bar&foo2=bar2&test[]=1&add=foo', Url::getQueryFromUrl('http://example.com/?foo=bar&foo2=bar2&test[]=1', array('add' => 'foo'))); + $this->assertEquals('add=foo', Url::getQueryFromUrl('/', array('add' => 'foo'))); + $this->assertEquals('add[]=foo&add[]=test', Url::getQueryFromUrl('/', array('add' => array('foo', 'test')))); + } } |