php - loading a class from a parent namespace -
i'm working on application in modular way, is, have interface , want make unit test classes implement interface made abstract class have logic implemented(testing if class implementing interface, testing return values , on) when try inherit abstract class class not found exception
i'm working namespaces directory structure this
namespacea |->abstract.php |->namespaceb |->plugintest.php
so plugintest.php class definition this
namespace namespacea\namespaceb; use namespacea\abstract; class plugintest extends abstract
and in abstract class there namespacea definition, have tried manually include file (include("../abstract.php")
) failed, since have used autoloading while maybe don't remember how manually import, have tried alias of class (using namespacea\abstract x
) , putting \
before namespacea nothing work, im doing wrong, or im missing
==edit==
i managed load class using
include __dir__ ."/../abstract.php";
but still not autoloading
i solved have add test directory module.php this
public function getautoloaderconfig() { return array( 'zend\loader\classmapautoloader' => array( __dir__ . '/autoload_classmap.php', ), 'zend\loader\standardautoloader' => array( 'namespaces' => array( __namespace__ => __dir__ . '/src/' . __namespace__, 'namespacea' => __dir__ . '/test/' .'namespacea', //added line ), ), ); }
Comments
Post a Comment