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

Commit

Permalink
Merge branch 'master' into markup
Browse files Browse the repository at this point in the history
Conflicts:
	library/Zend/Markup/Parser/Textile.php
	library/Zend/Markup/Renderer/AbstractRenderer.php
	library/Zend/Markup/Renderer/Html.php
  • Loading branch information
kokx committed Oct 30, 2010
2 parents 7db7f2b + 6020243 commit 614b493
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 65 deletions.
1 change: 0 additions & 1 deletion src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Adapter/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
* @namespace
*/
namespace Zend\ProgressBar\Adapter;
use Zend\ProgressBar\Adapter\Exception;

/**
* Zend_ProgressBar_Adapter_Console offers a text-based progressbar for console
Expand Down Expand Up @@ -188,7 +188,7 @@ public function setOutputStream($resource)
$stream = @fopen($resource, 'w');

if ($stream === false) {
throw new Exception('Unable to open stream');
throw new Exception\RuntimeException('Unable to open stream');
}

if ($this->_outputStream !== null) {
Expand Down Expand Up @@ -266,7 +266,7 @@ public function setElements(array $elements)
self::ELEMENT_TEXT);

if (count(array_diff($elements, $allowedElements)) > 0) {
throw new Exception('Invalid element found in $elements array');
throw new Exception\InvalidArgumentException('Invalid element found in $elements array');
}

$this->_elements = $elements;
Expand All @@ -286,7 +286,7 @@ public function setElements(array $elements)
public function setBarLeftChar($char)
{
if (empty($char)) {
throw new Exception('Character may not be empty');
throw new Exception\InvalidArgumentException('Character may not be empty');
}

$this->_barLeftChar = (string) $char;
Expand All @@ -304,7 +304,7 @@ public function setBarLeftChar($char)
public function setBarRightChar($char)
{
if (empty($char)) {
throw new Exception('Character may not be empty');
throw new Exception\InvalidArgumentException('Character may not be empty');
}

$this->_barRightChar = (string) $char;
Expand Down Expand Up @@ -364,7 +364,7 @@ public function setFinishAction($action)
self::FINISH_ACTION_NONE);

if (!in_array($action, $allowedActions)) {
throw new Exception('Invalid finish action specified');
throw new Exception\InvalidArgumentException('Invalid finish action specified');
}

$this->_finishAction = $action;
Expand Down
3 changes: 1 addition & 2 deletions src/Adapter/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand All @@ -34,6 +33,6 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Exception extends \Zend\ProgressBar\Exception
interface Exception extends \Zend\ProgressBar\Exception
{
}
41 changes: 41 additions & 0 deletions src/Adapter/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id$
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\ProgressBar\Adapter\Exception;
use Zend\ProgressBar\Adapter\Exception;

/**
* Exception for Zend_Progressbar component.
*
* @uses Zend\Exception
* @category Zend
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidArgumentException
extends \InvalidArgumentException
implements Exception
{
}
41 changes: 41 additions & 0 deletions src/Adapter/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id$
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\ProgressBar\Adapter\Exception;
use Zend\ProgressBar\Adapter\Exception;

/**
* Exception for Zend_Progressbar component.
*
* @uses Zend\Exception
* @category Zend
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class RuntimeException
extends \RuntimeException
implements Exception
{
}
1 change: 0 additions & 1 deletion src/Adapter/JsPull.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand Down
1 change: 0 additions & 1 deletion src/Adapter/JsPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand All @@ -34,6 +33,6 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Exception extends \Zend\Exception
interface Exception
{
}
41 changes: 41 additions & 0 deletions src/Exception/OutOfRangeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id$
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\ProgressBar\Exception;
use Zend\ProgressBar\Exception;

/**
* Exception for Zend_Progressbar component.
*
* @uses Zend\Exception
* @category Zend
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class OutOfRangeException
extends \OutOfRangeException
implements Exception
{
}
4 changes: 2 additions & 2 deletions src/ProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* @package Zend_ProgressBar
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
* @namespace
*/
namespace Zend\ProgressBar;
use Zend\ProgressBar\Exception;

/**
* Zend_ProgressBar offers an interface for multiple enviroments.
Expand Down Expand Up @@ -96,7 +96,7 @@ public function __construct(Adapter\AbstractAdapter $adapter, $min = 0, $max = 1
{
// Check min/max values and set them
if ($min > $max) {
throw new Exception('$max must be greater than $min');
throw new Exception\OutOfRangeException('$max must be greater than $min');
}

$this->_min = (float) $min;
Expand Down
66 changes: 26 additions & 40 deletions test/Adapter/ConsoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand Down Expand Up @@ -99,14 +98,8 @@ public function testFixedWidth()

public function testInvalidElement()
{
try {
$adapter = new Stub(array('width' => 30, 'elements' => array('foo')));
$adapter->notify(0, 100, 0, 0, null, null);

$this->fail('An expected Zend_ProgressBar_Adapter_Exception has not been raised');
} catch (Adapter\Exception $expected) {
$this->assertContains('Invalid element found in $elements array', $expected->getMessage());
}
$this->setExpectedException('Zend\ProgressBar\Adapter\Exception\InvalidArgumentException', 'Invalid element found');
$adapter = new Stub(array('width' => 30, 'elements' => array('foo')));
}

public function testCariageReturn()
Expand Down Expand Up @@ -244,13 +237,12 @@ public function testSetOutputStreamOpen() {
$this->assertArrayHasKey('test1', MockupStream::$tests);
}

public function testSetOutputStreamOpenFail() {
try {
$adapter = new Adapter\Console();
$adapter->setOutputStream(null);
$this->fail('Expected Zend_ProgressBar_Adapter_Exception');
} catch (Adapter\Exception $e) {
}
public function testSetOutputStreamOpenFail()
{
$adapter = new Adapter\Console();

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

public function testSetOutputStreamReplaceStream() {
Expand Down Expand Up @@ -291,34 +283,28 @@ public function testFinishNone() {
$this->assertEquals('', MockupStream::$tests['test7']);
}

public function testSetBarLeftChar() {
try {
$adapter = new Adapter\Console();
$adapter->setBarLeftChar(null);
$this->fail('Expected Zend_ProgressBar_Adapter_Exception');
} catch (Adapter\Exception $e) {
$this->assertEquals($e->getMessage(), 'Character may not be empty');
}
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() {
try {
$adapter = new Adapter\Console();
$adapter->setBarRightChar(null);
$this->fail('Expected Zend_ProgressBar_Adapter_Exception');
} catch (Adapter\Exception $e) {
$this->assertEquals($e->getMessage(), 'Character may not be empty');
}
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() {
try {
$adapter = new Adapter\Console();
$adapter->setFinishAction('CUSTOM_FINISH_ACTION');
$this->fail('Expected Zend_ProgressBar_Adapter_Exception');
} catch (Adapter\Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid finish action specified');
}
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
1 change: 0 additions & 1 deletion test/Adapter/JsPullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand Down
1 change: 0 additions & 1 deletion test/Adapter/JsPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand Down
1 change: 0 additions & 1 deletion test/Adapter/MockupStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
Expand Down
Loading

0 comments on commit 614b493

Please sign in to comment.