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

Commit

Permalink
Merge commit 'zf2/master' into livedocx-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 90 deletions.
4 changes: 2 additions & 2 deletions src/ClassFileLocater.php → src/ClassFileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
* @package Zend_File
* @license New BSD {@link http://framework.zend.com/license/new-bsd}
*/
class ClassFileLocater extends FilterIterator
class ClassFileLocator extends FilterIterator
{
/**
* Create an instance of the locater iterator
* Create an instance of the locator iterator
*
* Expects either a directory, or a DirectoryIterator (or its recursive variant)
* instance.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_File
* @subpackage Exception
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_File
* @subpackage Exception
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
22 changes: 11 additions & 11 deletions src/Transfer/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -27,23 +27,23 @@
Zend\File\Transfer\Exception,
Zend\Loader\PrefixPathLoader,
Zend\Loader\PrefixPathMapper,
Zend\Loader\ShortNameLocater,
Zend\Loader\ShortNameLocator,
Zend\Validator,
Zend\Filter;

/**
* Abstract class for file transfers (Downloads and Uploads)
*
* This class needs a full rewrite. It re-implements functionality present in
* This class needs a full rewrite. It re-implements functionality present in
* Zend_Filter_Input and/or Zend_Form_Element, and in a way that's inconsistent
* with either one. Additionally, plugin loader usage is now deprecated -- but
* modifying that should be done in tandem with a rewrite to utilize validator
* modifying that should be done in tandem with a rewrite to utilize validator
* and filter chains instead.
*
* @todo Rewrite
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class AbstractAdapter
Expand Down Expand Up @@ -212,23 +212,23 @@ abstract public function isFiltered($files = null);
* @throws \Zend\File\Transfer\Exception Not implemented
*/
//abstract public function addType($type, $validator = null, $filter = null);

/**
* Returns all set files
*
* @return array List of set files
*/
//abstract public function getFile();

/**
* Set plugin loader to use for validator or filter chain
*
* @param \Zend\Loader\PrefixPathMapper $loader
* @param \Zend\Loader\ShortNameLocator $loader
* @param string $type 'filter', or 'validator'
* @return \Zend\File\Transfer\Adapter\AbstractAdapter
* @throws \Zend\File\Transfer\Exception on invalid type
*/
public function setPluginLoader(ShortNameLocater $loader, $type)
public function setPluginLoader(ShortNameLocator $loader, $type)
{
$type = strtoupper($type);
switch ($type) {
Expand All @@ -248,7 +248,7 @@ public function setPluginLoader(ShortNameLocater $loader, $type)
* 'filter' or 'validator' for $type.
*
* @param string $type
* @return \Zend\Loader\ShortNameLocater
* @return \Zend\Loader\ShortNameLocator
* @throws \Zend\File\Transfer\Exception on invalid type.
*/
public function getPluginLoader($type)
Expand Down Expand Up @@ -623,7 +623,7 @@ public function setOptions($options = array(), $files = null) {
break;

default:
throw new Exception\InvalidArgumentException("Unknown option: $name = $value");
continue;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Transfer/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -35,7 +35,7 @@
* @uses \Zend\ProgressBar\ProgressBar
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Http extends AbstractAdapter
Expand Down
24 changes: 3 additions & 21 deletions src/Transfer/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -26,30 +26,12 @@
/**
* Exception class for Zend_File_Transfer
*
* @uses \Zend\Exception
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
{
// protected $_fileerror = null;
//
// public function __construct($message, $fileerror = 0)
// {
// $this->_fileerror = $fileerror;
// parent::__construct($message);
// }
//
// /**
// * Returns the transfer error code for the exception
// * This is not the exception code !!!
// *
// * @return integer
// */
// public function getFileError()
// {
// return $this->_fileerror;
// }

}
4 changes: 2 additions & 2 deletions src/Transfer/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
* @uses \Zend\Loader
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Transfer
Expand Down
41 changes: 21 additions & 20 deletions test/ClassFileLocater.php → test/ClassFileLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,55 @@
* @category Zend
* @package Zend_File
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace ZendTest\File;

use Zend\File\ClassFileLocater;
use Zend\File\ClassFileLocator,
PHPUnit_Framework_TestCase as TestCase;

/**
* Test class for Zend\File\ClassFileLocater
* Test class for Zend\File\ClassFileLocator
*
* @category Zend
* @package Zend_File
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_File
*/
class ClassFileLocaterTest extends \PHPUnit_Framework_TestCase
class ClassFileLocatorTest extends TestCase
{

public function testConstructorThrowsInvalidArgumentExceptionForInvalidStringDirectory()
{
$this->setExpectedException('Zend\File\Exception\InvalidArgumentException');
$locater = new ClassFileLocater('__foo__');
$locator = new ClassFileLocator('__foo__');
}

public function testConstructorThrowsInvalidArgumentExceptionForNonDirectoryIteratorArgument()
{
$iterator = new \ArrayIterator(array());
$this->setExpectedException('Zend\File\Exception\InvalidArgumentException');
$locater = new ClassFileLocater($iterator);
$locator = new ClassFileLocator($iterator);
}

public function testIterationShouldReturnOnlyPhpFiles()
{
$locater = new ClassFileLocater(__DIR__);
foreach ($locater as $file) {
$locator = new ClassFileLocator(__DIR__);
foreach ($locator as $file) {
$this->assertRegexp('/\.php$/', $file->getFilename());
}
}

public function testIterationShouldReturnOnlyPhpFilesContainingClasses()
{
$locater = new ClassFileLocater(__DIR__);
$locator = new ClassFileLocator(__DIR__);
$found = false;
foreach ($locater as $file) {
if (preg_match('/locater-should-skip-this\.php$/', $file->getFilename())) {
foreach ($locator as $file) {
if (preg_match('/locator-should-skip-this\.php$/', $file->getFilename())) {
$found = true;
}
}
Expand All @@ -71,30 +72,30 @@ public function testIterationShouldReturnOnlyPhpFilesContainingClasses()

public function testIterationShouldReturnInterfaces()
{
$locater = new ClassFileLocater(__DIR__);
$locator = new ClassFileLocator(__DIR__);
$found = false;
foreach ($locater as $file) {
if (preg_match('/LocaterShouldFindThis\.php$/', $file->getFilename())) {
foreach ($locator as $file) {
if (preg_match('/LocatorShouldFindThis\.php$/', $file->getFilename())) {
$found = true;
}
}
$this->assertTrue($found, "Locater skipped an interface?");
$this->assertTrue($found, "Locator skipped an interface?");
}

public function testIterationShouldInjectNamespaceInFoundItems()
{
$locater = new ClassFileLocater(__DIR__);
$locator = new ClassFileLocator(__DIR__);
$found = false;
foreach ($locater as $file) {
foreach ($locator as $file) {
$this->assertTrue(isset($file->namespace));
}
}

public function testIterationShouldInjectClassInFoundItems()
{
$locater = new ClassFileLocater(__DIR__);
$locator = new ClassFileLocator(__DIR__);
$found = false;
foreach ($locater as $file) {
foreach ($locator as $file) {
$this->assertTrue(isset($file->classname));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Loader
* @subpackage Exception
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -24,9 +24,9 @@
/**
* @package Zend_Loader
* @subpackage Exception
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface LocaterShouldFindThis
interface LocatorShouldFindThis
{
}
Loading

0 comments on commit 929c939

Please sign in to comment.