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' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
vahid-sohrabloo committed Jun 19, 2012
7 parents f3e25dd + 6dbeef6 + 84670b1 + cccfba9 + 2717653 + b4dd364 + 460818e commit 90b4677
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/Compress/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function compress($content)
* Decompresses the given content
*
* @param string $content
* @return boolean
* @return string
* @throws Exception\RuntimeException if unable to find archive
* @throws Exception\RuntimeException if error occurs decompressing archive
*/
Expand All @@ -225,15 +225,15 @@ public function decompress($content)
$archive = new Archive_Tar($archive, $this->getMode());
$target = $this->getTarget();
if (!is_dir($target)) {
$target = dirname($target);
$target = dirname($target) . DIRECTORY_SEPARATOR;
}

$result = $archive->extract($target);
if ($result === false) {
throw new Exception\RuntimeException('Error while extracting the Tar archive');
}

return true;
return $target;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Encrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

use Traversable;
use Zend\Stdlib\ArrayUtils;
use Zend\Loader;

/**
* Encrypts a given string
Expand Down Expand Up @@ -84,7 +83,7 @@ public function setAdapter($options = null)
$options = array();
}

if (Loader::isReadable('Zend/Filter/Encrypt/' . ucfirst($adapter). '.php')) {
if (stream_resolve_include_path('Zend/Filter/Encrypt/' . ucfirst($adapter). '.php')) {
$adapter = 'Zend\\Filter\\Encrypt\\' . ucfirst($adapter);
}

Expand Down
2 changes: 1 addition & 1 deletion src/PregReplace.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function getReplacement()
public function filter($value)
{
if ($this->_matchPattern == null) {
throw new Exception\RuntimeException(get_class($this) . ' does not have a valid MatchPattern set.');
throw new Exception\RuntimeException(get_called_class() . ' does not have a valid MatchPattern set.');
}

return preg_replace($this->_matchPattern, $this->_replacement, $value);
Expand Down
2 changes: 1 addition & 1 deletion src/StringTrim.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ protected function _unicodeTrim($value, $charlist = '\\\\s')
);

$pattern = '^[' . $chars . ']*|[' . $chars . ']*$';
return preg_replace("/$pattern/usSD", '', $value);
return preg_replace("/$pattern/sSD", '', $value);
}
}
30 changes: 18 additions & 12 deletions test/StringTrimTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace ZendTest\Filter;

use stdClass;
use Zend\Filter\StringTrim as StringTrimFilter;
use Zend\Filter\StringTrim;

/**
* @category Zend
Expand All @@ -35,20 +35,18 @@
class StringTrimTest extends \PHPUnit_Framework_TestCase
{
/**
* Zend_Filter_StringTrim object
*
* @var Zend_Filter_StringTrim
* @var StringTrim
*/
protected $_filter;

/**
* Creates a new Zend_Filter_StringTrim object for each test method
* Creates a new Zend\Filter\StringTrim object for each test method
*
* @return void
*/
public function setUp()
{
$this->_filter = new StringTrimFilter();
$this->_filter = new StringTrim();
}

/**
Expand Down Expand Up @@ -103,7 +101,7 @@ public function testCharList()
}

/**
* @ZF-7183
* @group ZF-7183
*/
public function testZF7183()
{
Expand All @@ -112,7 +110,17 @@ public function testZF7183()
}

/**
* @ZF-7902
* @group ZF2-170
*/
public function testZF2170()
{
$filter = $this->_filter;
$this->assertEquals('Расчет', $filter('Расчет'));
}


/**
* @group ZF-7902
*/
public function testZF7902()
{
Expand All @@ -121,7 +129,7 @@ public function testZF7902()
}

/**
* @ZF-10891
* @group ZF-10891
*/
public function testZF10891()
{
Expand All @@ -131,10 +139,8 @@ public function testZF10891()
$this->assertEquals('Зенд', $filter(' Зенд'));

$trim_charlist = " \t\n\r\x0B・。";
$filter = new StringTrimFilter($trim_charlist);
$filter = new StringTrim($trim_charlist);
$this->assertEquals('Зенд', $filter->filter('。 Зенд 。'));


}

public function getNonStringValues()
Expand Down

0 comments on commit 90b4677

Please sign in to comment.