I am writing unit tests for a project that use apigility but for some reason the tests classes do not recognize que namespace of the real classes.
here is a test class :
namespace Testzfnewsite\V1\Rest\SendEmail\Entity\DAO;
use PHPUnit_Framework_TestCase;
class GenericDAOTest extends PHPUnit_Framework_TestCase {
public function test_verifica_se_a_classe_existe(){
$classe = class_exists('\\zfnewsite\\V1\\Rest\\SendEmail\\Entity\\DAO\\GenericDAO');
$this->assertTrue($classe);
}
}
In this example, the class_exists function result is always false, I've checked the namespace and the class name and it is rigth, It's seens that this test class dont see the namespace of the real aplication.
This is structure of the zfnewsite module.
_zfnewsite
|
|_config
|
|_src
| |
| |_zfnewsite
| |
| |_V1
| | |
| | |_Rest
| | | |
| | | |_SendEmail
| | | | |
| | | | |_Entity
| | | | | |
| | | | | |_DAO
| | | | | |
| | | | | |_GenericDAO.php
| | | | | |_GenericDAOImpl.php
| | | | |
| | | | |_Service
| | | |
| | | |_Status
| | |
| | |_Rcp
| |
| |_Module.php
|
|_test
| |
| |_zfnewsite
| |
| |_V1
| | |
| | |_Rest
| | | |
| | | |_SendEmail
| | | | |
| | | | |_Entity
| | | | | |
| | | | | |_DAO
| | | | | |
| | | | | |_GenericDAOTest.php
| | | | | |_GenericDAOImplTest.php
| | | | |
| | | | |_Service
| | | |
| | | |_Status
| | |
| | |_Rcp
| |
| |_Bootstrap.php
|
|_Module.php
I need help to figure out what is wrong with this testing enviroment,There is diference in tests for a normal zf2 application and apigility?
This is the code for the class GenericDAO:
namespace zfnewsite\V1\Rest\SendEmail\Entity\DAO;
interface GenericDAO
{
public function save($data);
public function update($id, $data);
public function findOneBy(array $where);
public function findById($id);
public function findAll();
public function delete($id);
}