-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from zf1s/loader-overhauled-again
zend-loader and autoloader overhaul - cont.
Showing
26 changed files
with
343 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/zend-loader/library/Zend/Loader/Exception/ClassNotFoundException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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 [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Loader | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
// require_once dirname(__FILE__) . '/../Exception.php'; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Loader | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class Zend_Loader_Exception_ClassNotFoundException extends Zend_Loader_Exception | ||
{ | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
packages/zend-loader/library/Zend/Loader/Exception/FileNotFoundException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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 [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Loader | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
// require_once dirname(__FILE__) . '/../Exception.php'; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Loader | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class Zend_Loader_Exception_FileNotFoundException extends Zend_Loader_Exception | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/Zend/Loader/_files/ZendLoaderAutoloader/ClassNonexistent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
/** | ||
* A file not containing a class | ||
*/ |
9 changes: 9 additions & 0 deletions
9
tests/Zend/Loader/_files/ZendLoaderAutoloader/SomethingWrong.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
/** | ||
* A class containing a parse error | ||
*/ | ||
class ZendLoaderAutoloader_SomethingWrong | ||
{ | ||
} | ||
|
||
trigger_error('Something is wrong here', E_USER_WARNING); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?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_Translate | ||
* @subpackage UnitTests | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @version $Id$ | ||
*/ | ||
|
||
if (!defined('PHPUnit_MAIN_METHOD')) { | ||
define('PHPUnit_MAIN_METHOD', 'Zend_Translate_Adapter_CustomAdapterTest::main'); | ||
} | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Translate | ||
* @subpackage UnitTests | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @group Zend_Translate | ||
*/ | ||
class Zend_Translate_Adapter_CustomAdapterTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Runs the test methods of this class. | ||
* | ||
* @return void | ||
*/ | ||
public static function main() | ||
{ | ||
$suite = new PHPUnit_Framework_TestSuite("Zend_Translate_Adapter_CustomAdapterTest"); | ||
$result = PHPUnit_TextUI_TestRunner::run($suite); | ||
} | ||
|
||
public function setUp() | ||
{ | ||
// Store original include_path | ||
$this->includePath = get_include_path(); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
// Restore original include_path | ||
set_include_path($this->includePath); | ||
|
||
// Reset autoloader instance so it doesn't affect other tests | ||
Zend_Loader_Autoloader::resetInstance(); | ||
} | ||
|
||
public function testCreate() | ||
{ | ||
$this->addTestIncludePath(); | ||
|
||
$translate = new Zend_Translate('My_CustomAdapter', array('test' => 'translated'), 'en'); | ||
$this->assertTrue(true); | ||
} | ||
|
||
public function testCreateWithZendAutoloaderEnabled() | ||
{ | ||
$this->addTestIncludePath(); | ||
|
||
// register zend autoloader | ||
Zend_Loader_Autoloader::getInstance(); | ||
|
||
$translate = new Zend_Translate('My_CustomAdapter', array('test' => 'translated'), 'en'); | ||
$this->assertTrue(true); | ||
} | ||
|
||
public function addTestIncludePath() | ||
{ | ||
set_include_path(__DIR__ . '/_files/' . PATH_SEPARATOR . $this->includePath); | ||
} | ||
|
||
} | ||
|
||
// Call Zend_Translate_Adapter_CustomAdapterTest::main() if this source file is executed directly. | ||
if (PHPUnit_MAIN_METHOD == "Zend_Translate_Adapter_CustomAdapterTest::main") { | ||
Zend_Translate_Adapter_CustomAdapterTest::main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
class My_CustomAdapter extends Zend_Translate_Adapter { | ||
protected function _loadTranslationData($data, $locale, array $options = array()) | ||
{ | ||
return array($locale => $data); | ||
} | ||
|
||
public function toString() | ||
{ | ||
return "My_CustomAdapter"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters