Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
[PSR-2] fixers=braces,elseif,short_tag,php_closing_tag,trailing_space…
Browse files Browse the repository at this point in the history
…s,linefeed

Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed
  • Loading branch information
Maks3w committed Jul 12, 2012
1 parent 1d7c8db commit aa8a772
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Adapter/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function setWidth($width = null)
// Try to determine the width through stty
if (preg_match('#\d+ (\d+)#', @shell_exec('stty size'), $match) === 1) {
$this->_width = (int) $match[1];
} else if (preg_match('#columns = (\d+);#', @shell_exec('stty'), $match) === 1) {
} elseif (preg_match('#columns = (\d+);#', @shell_exec('stty'), $match) === 1) {
$this->_width = (int) $match[1];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
* @category Zend
* @package Zend_ProgressBar
*/
class InvalidArgumentException extends Exception\InvalidArgumentException implements
class InvalidArgumentException extends Exception\InvalidArgumentException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Adapter/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
* @category Zend
* @package Zend_ProgressBar
*/
class RuntimeException extends Exception\RuntimeException implements
class RuntimeException extends Exception\RuntimeException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
* @category Zend
* @package Zend_ProgressBar
*/
class InvalidArgumentException extends \InvalidArgumentException implements
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{}
26 changes: 16 additions & 10 deletions test/Adapter/ConsoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ public function testTextElementCustomLength()
$this->assertContains('foobar [', $adapter->getLastOutput());
}

public function testSetOutputStreamOpen() {
public function testSetOutputStreamOpen()
{
$adapter = new Adapter\Console();
$adapter->setOutputStream('zendprogressbaradapterconsole://test1');
$this->assertArrayHasKey('test1', MockupStream::$tests);
Expand All @@ -225,12 +226,13 @@ public function testSetOutputStreamOpen() {
public function testSetOutputStreamOpenFail()
{
$adapter = new Adapter\Console();

$this->setExpectedException('Zend\ProgressBar\Adapter\Exception\RuntimeException', 'Unable to open stream');
$adapter->setOutputStream(null);
}

public function testSetOutputStreamReplaceStream() {
public function testSetOutputStreamReplaceStream()
{
$adapter = new Adapter\Console();
$adapter->setOutputStream('zendprogressbaradapterconsole://test2');
$this->assertArrayHasKey('test2', MockupStream::$tests);
Expand All @@ -239,28 +241,32 @@ public function testSetOutputStreamReplaceStream() {
$this->assertArrayNotHasKey('test2', MockupStream::$tests);
}

public function testgetOutputStream() {
public function testgetOutputStream()
{
$adapter = new Adapter\Console();
$adapter->setOutputStream('zendprogressbaradapterconsole://test4');
$resource = $adapter->getOutputStream();
fwrite($resource, 'Hello Word!');
$this->assertEquals('Hello Word!', MockupStream::$tests['test4']);
}

public function testgetOutputStreamReturnigStdout() {
public function testgetOutputStreamReturnigStdout()
{
$adapter = new Adapter\Console();
$resource = $adapter->getOutputStream();
$this->assertTrue(is_resource($resource));
}

public function testFinishEol() {
public function testFinishEol()
{
$adapter = new Adapter\Console();
$adapter->setOutputStream('zendprogressbaradapterconsole://test5');
$adapter->finish();
$this->assertEquals(PHP_EOL, MockupStream::$tests['test5']);
}

public function testFinishNone() {
public function testFinishNone()
{
$adapter = new Adapter\Console();
$adapter->setOutputStream('zendprogressbaradapterconsole://test7');
$adapter->setFinishAction(Adapter\Console::FINISH_ACTION_NONE);
Expand All @@ -271,23 +277,23 @@ public function testFinishNone() {
public function testSetBarLeftChar()
{
$adapter = new Adapter\Console();

$this->setExpectedException('Zend\ProgressBar\Adapter\Exception\InvalidArgumentException','Character may not be empty');
$adapter->setBarLeftChar(null);
}

public function testSetBarRightChar()
{
$adapter = new Adapter\Console();

$this->setExpectedException('Zend\ProgressBar\Adapter\Exception\InvalidArgumentException','Character may not be empty');
$adapter->setBarRightChar(null);
}

public function testSetInvalidFinishAction()
{
$adapter = new Adapter\Console();

$this->setExpectedException('Zend\ProgressBar\Adapter\Exception\InvalidArgumentException','Invalid finish action specified');
$adapter->setFinishAction('CUSTOM_FINISH_ACTION');
}
Expand Down
3 changes: 2 additions & 1 deletion test/Adapter/MockupStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ function stream_seek($offset, $whence)
}
}

public function __destruct() {
public function __destruct()
{
unset(self::$tests[$this->test]);
}
}
2 changes: 1 addition & 1 deletion test/ProgressBarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class ProgressBarTest extends \PHPUnit_Framework_TestCase
{

public function testGreaterMin()
{
$this->setExpectedException('Zend\ProgressBar\Exception\OutOfRangeException', '$max must be greater than $min');
Expand Down

0 comments on commit aa8a772

Please sign in to comment.