autoload

composer package testing bootstrap

一笑奈何 提交于 2019-12-01 17:55:47
I've written a package and as part of the development proccess I want to run unit tests on it. This basically means I need a bootstrap file to register the autoloader for my package. Any package I look at doesn't have a specific bootstrap file, thus I don't quite understand how the developers are testing their own packages. This is my directory structure src .CompanyName ..PackageName ...Class 1 ...Class 2 tests .Class1Test .Class2Test composer.json phpunit.xml.dist Now if I run phpunit inside the root directory, all my tests say \\CompanyName\\PackageName\\Class1 wasn't found. Which is legite

Why doesn't PHP's Autoload feature work in CLI mode?

旧巷老猫 提交于 2019-12-01 16:15:55
This is more for my own personal edification than anything else but, this is something that has always bothered me: Why specifically can't PHP perform "autoloading" while in CLI mode? I've been reading this disclaimer for years, but I've never read anything that touches on why: http://php.net/manual/en/language.oop5.autoload.php : Note: Autoloading is not available if using PHP in CLI interactive mode. Does anyone know what is preventing PHP, as a language, from autoloading while working in CLI mode? Autoloading on the command line works. Do note the mention of "interactive". PHP comes with

iphone navigationController autoloading to three level

别说谁变了你拦得住时间么 提交于 2019-12-01 14:58:09
i create i navigationController project name:autoload, then create two uiviewContorller named: second,three i want the process is load rootView the load second in method:"viewDidLoad" then auto load three in method"viewdidload", here is the code: rootView: - (void)viewDidLoad { self.title = @"first"; Second *second = [[Second alloc] init]; AutoLoadAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; [delegate.navigationController pushViewController:second animated:YES]; [super viewDidLoad]; } second: - (void)viewDidLoad { self.title = @"second"; [super viewDidLoad]; } now

Way to require an autoload in one file on a Prestashop module?

余生长醉 提交于 2019-12-01 13:22:13
I'm trying to use a set of libraries with Composer for a Prestashop module. My current approach is to include the vendor/autoload.php file on every file ( mymodule.php , controllers/front/foo.php , controllers/admin/bar.php , etc.) Doing the require only on top of the mymodule.php is not a solution, I don't see any hook to do the task. Is there a better approach than copy & paste the same snippet on top of every PHP file? Thank you! I've found the way to do it! The actionDispatcher hook was working for me with models, hooks, but not with controllers. Seems like there is a not documented hook

Way to require an autoload in one file on a Prestashop module?

寵の児 提交于 2019-12-01 11:12:22
问题 I'm trying to use a set of libraries with Composer for a Prestashop module. My current approach is to include the vendor/autoload.php file on every file ( mymodule.php , controllers/front/foo.php , controllers/admin/bar.php , etc.) Doing the require only on top of the mymodule.php is not a solution, I don't see any hook to do the task. Is there a better approach than copy & paste the same snippet on top of every PHP file? Thank you! 回答1: I've found the way to do it! The actionDispatcher hook

autoload differnece between class and interface php

╄→尐↘猪︶ㄣ 提交于 2019-12-01 11:07:05
I'm searching for following issue i have. The class file names of our project are named logon.class.php But the interface file for that class is named logon.interface.php My issue i have is that when the autoload method runs I should be able to detect if it is a class call or an interface call. <?php function __autoload($name){ if($name === is_class){ include_once($name.'class.php'); }elseif ($name === is_interface){ include_once($name.'interface.php'); } } ?> You can use ReflectionClass::isInterface to determine if the class is an interface. $reflection = new ReflectionClass($name); if (

autoload differnece between class and interface php

耗尽温柔 提交于 2019-12-01 09:39:12
问题 I'm searching for following issue i have. The class file names of our project are named logon.class.php But the interface file for that class is named logon.interface.php My issue i have is that when the autoload method runs I should be able to detect if it is a class call or an interface call. <?php function __autoload($name){ if($name === is_class){ include_once($name.'class.php'); }elseif ($name === is_interface){ include_once($name.'interface.php'); } } ?> 回答1: You can use ReflectionClass

Auto load fancybox using .trigger('click')

别说谁变了你拦得住时间么 提交于 2019-12-01 08:24:16
I was just wondering if you could please help. I am trying to get the fancybox to load automatically once the page is rendered. However, I got this error message 't is undefined' at line 18 (/js/fancybox/ jquery.fancybox-1.3.3.pack.js). At the moment, I am using jquery version 1.4.2 <a href="#container" id="profile">Click me</a> <div style="display:none"> <div id="container">Fancybox Content Here .... </div> </div> <script type="text/javascript"> $(document).ready(function(){ $('#profile').fancybox().trigger('click'); }); </script> The funny thing is if I take the line below and run it in

Auto load fancybox using .trigger('click')

梦想的初衷 提交于 2019-12-01 06:59:04
问题 I was just wondering if you could please help. I am trying to get the fancybox to load automatically once the page is rendered. However, I got this error message 't is undefined' at line 18 (/js/fancybox/ jquery.fancybox-1.3.3.pack.js). At the moment, I am using jquery version 1.4.2 <a href="#container" id="profile">Click me</a> <div style="display:none"> <div id="container">Fancybox Content Here .... </div> </div> <script type="text/javascript"> $(document).ready(function(){ $('#profile')

Composer Not Generating Autoloads For Library

我怕爱的太早我们不能终老 提交于 2019-12-01 03:06:17
I've set up two projects, an 'init' and a library, which is required by the init. They both have PSR-0 autoloads set, but the autoload values from the library are not added to the vendor/composer/autoload_namespaces.php in the init project. Sample composer.json from the Library: { "name": "lxp/library", "description": "A test library", "autoload": { "psr-0": { "LXP\\Library": "src/" } } } Sample composer.json from the project that requires that library: { "name": "lxp/init", "name": "A test init", "autoload": { "psr-0": { "LXP\\Init": "src/" } }, "repositories": [ { "type": "composer", "url":