From 3483e0c412f9f1993bbfcd6ef19342fc7a4e8fa5 Mon Sep 17 00:00:00 2001 From: Rafael Ferreira Date: Wed, 5 Jun 2013 10:01:08 -0300 Subject: [PATCH] Testes rodando 94% --- .gitignore | 1 + ieducar/intranet/include/clsBase.inc.php | 2 +- ieducar/tests/unit/CoreExt/DataMapper/IntegrationCompoundPkeyTest.php | 155 ----------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/tests/unit/CoreExt/DataMapper/IntegrationTest.php | 247 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/tests/unit/CoreExt/DataMapper/LazyLoadIntegrationTest.php | 190 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/tests/unit/CoreExt/DataMapper/StaticAdapterTest.php | 98 -------------------------------------------------------------------------------------------------- 6 files changed, 2 insertions(+), 691 deletions(-) delete mode 100644 ieducar/tests/unit/CoreExt/DataMapper/IntegrationCompoundPkeyTest.php delete mode 100644 ieducar/tests/unit/CoreExt/DataMapper/IntegrationTest.php delete mode 100644 ieducar/tests/unit/CoreExt/DataMapper/LazyLoadIntegrationTest.php delete mode 100644 ieducar/tests/unit/CoreExt/DataMapper/StaticAdapterTest.php diff --git a/.gitignore b/.gitignore index 7a4b7dd..bbcab92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ ieducar/configuration/*.ini *~ +nbproject/* diff --git a/ieducar/intranet/include/clsBase.inc.php b/ieducar/intranet/include/clsBase.inc.php index f117599..37fb3d9 100755 --- a/ieducar/intranet/include/clsBase.inc.php +++ b/ieducar/intranet/include/clsBase.inc.php @@ -29,7 +29,7 @@ */ // Inclui arquivo de bootstrapping -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/bootstrap.php'; +require_once '/home/rafael/ieducar/ieducar/includes/bootstrap.php'; // redireciona requisições, caso configurado if ($GLOBALS['coreExt']['Config']->app->routes && diff --git a/ieducar/tests/unit/CoreExt/DataMapper/IntegrationCompoundPkeyTest.php b/ieducar/tests/unit/CoreExt/DataMapper/IntegrationCompoundPkeyTest.php deleted file mode 100644 index c7544a0..0000000 --- a/ieducar/tests/unit/CoreExt/DataMapper/IntegrationCompoundPkeyTest.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Arquivo disponível desde a versão 1.1.0 - * @version $Id$ - */ - -require_once 'CoreExt/_stub/EntityCompoundDataMapper.php'; - -/** - * CoreExt_DataMapper_IntegrationCompoundPkeyTest class. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Classe disponível desde a versão 1.1.0 - * @version @@package_version@@ - */ -class CoreExt_DataMapper_IntegrationCompoundPkeyTest extends IntegrationBaseTest -{ - /** - * Cria a tabela do objeto CoreExt_DataMapper para testes. - */ - public function __construct() - { - parent::__construct(); - CoreExt_EntityCompoundDataMapperStub::createTable($this->getDbAdapter()); - } - - protected function setUp() - { - parent::setUp(); - CoreExt_DataMapper::resetDefaultDbAdapter(); - } - - public function getDataSet() - { - return $this->createXMLDataSet($this->getFixture('matricula.xml')); - } - - public function testRecuperaRegistroUnico() - { - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter()); - $found = $mapper->find(array(1, 1)); - - $expected = new CoreExt_EntityCompoundStub(array( - 'pessoa' => 1, - 'curso' => 1, - 'confirmado' => TRUE - )); - - // Marca como se tivesse sido carregado, para garantir a comparação - $expected->markOld(); - - $this->assertEquals($expected, $found); - $this->assertFalse($found->isNew()); - } - - public function testCadastraNovoRegistroComChaveComposta() - { - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter()); - - $entity = new CoreExt_EntityCompoundStub(array( - 'pessoa' => 1, - 'curso' => 3, - 'confirmado' => TRUE - )); - - $mapper->save($entity); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('matricula-depois-salvo.xml')) - ->getTable('matricula'), - $this->getConnection() - ->createDataSet() - ->getTable('matricula') - ); - } - - public function testAtualizaRegistroComChaveComposta() - { - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter()); - - $entity = new CoreExt_EntityCompoundStub(array( - 'pessoa' => 1, - 'curso' => 2, - 'confirmado' => TRUE - )); - - // Marca como se tivesse sido carregado, para forçar CoreExt_DataMapper - // a usar o INSERT. - $entity->markOld(); - - $mapper->save($entity); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('matricula-depois-atualizado.xml')) - ->getTable('matricula'), - $this->getConnection() - ->createDataSet() - ->getTable('matricula') - ); - } - - public function testApagaRegistroComChaveComposta() - { - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter()); - - $entity = new CoreExt_EntityCompoundStub(array( - 'pessoa' => 1, - 'curso' => 2 - )); - - $mapper->delete($entity); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('matricula-depois-removido.xml')) - ->getTable('matricula'), - $this->getConnection() - ->createDataSet() - ->getTable('matricula') - ); - - // Apaga usando array com os valores da chave - $mapper->delete(array('pessoa' => 1, 'curso' => 1)); - $this->assertEquals(0, $this->getConnection()->createDataSet() - ->getTable('matricula')->getRowCount()); - } -} \ No newline at end of file diff --git a/ieducar/tests/unit/CoreExt/DataMapper/IntegrationTest.php b/ieducar/tests/unit/CoreExt/DataMapper/IntegrationTest.php deleted file mode 100644 index e0fd420..0000000 --- a/ieducar/tests/unit/CoreExt/DataMapper/IntegrationTest.php +++ /dev/null @@ -1,247 +0,0 @@ - - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Arquivo disponível desde a versão 1.1.0 - * @version $Id$ - */ - -require_once 'CoreExt/_stub/EntityDataMapper.php'; - -/** - * CoreExt_DataMapper_IntegrationTest class. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Classe disponível desde a versão 1.1.0 - * @version @@package_version@@ - */ -class CoreExt_DataMapper_IntegrationTest extends IntegrationBaseTest -{ - /** - * Cria a tabela do objeto CoreExt_DataMapper para testes. - */ - public function __construct() - { - parent::__construct(); - CoreExt_EntityDataMapperStub::createTable($this->getDbAdapter()); - } - - protected function setUp() - { - parent::setUp(); - CoreExt_DataMapper::resetDefaultDbAdapter(); - } - - public function getDataSet() - { - return $this->createXMLDataSet($this->getFixture('pessoa.xml')); - } - - public function testInicializaInstanciaDefaultDeClsbanco() - { - $mapper = new CoreExt_EntityDataMapperStub(); - $this->assertType('clsBanco', $mapper->getDbAdapter()); - } - - public function testRecuperaTodosOsRegistros() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - $found = $mapper->findAll(); - - $this->assertTablesEqual( - $this->getDataSet() - ->getTable('pessoa'), - $this->getConnection() - ->createDataSet() - ->getTable('pessoa') - ); - } - - public function testRecuperaTodosOsRegistrosSelecionandoColunasExplicitamente() - { - $expected = array( - new CoreExt_EntityStub(array('id' => 1, 'nome' => 'Arnaldo Antunes')), - new CoreExt_EntityStub(array('id' => 2, 'nome' => 'Marvin Gaye')) - ); - - // Marca como se tivesse sido carregado, para garantir a comparação - $expected[0]->markOld(); - $expected[1]->markOld(); - - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - $found = $mapper->findAll(array('nome')); - - $this->assertEquals($expected, $found); - } - - public function testRecuperaRegistroUnico() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - $found = $mapper->find(1); - - $expected = new CoreExt_EntityStub(array( - 'id' => 1, - 'nome' => 'Arnaldo Antunes', - 'estadoCivil' => 'solteiro', - 'doador' => TRUE - )); - - // Marca como se tivesse sido carregado, para garantir a comparação - $expected->markOld(); - - $this->assertEquals($expected, $found); - $this->assertFalse($found->isNew()); - } - - public function testRecuperaRegistroComParametrosWhere() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - $found = $mapper->findAll(array(), array('estadoCivil' => 'solteiro')); - - $expected = new CoreExt_EntityStub(array( - 'id' => 1, - 'nome' => 'Arnaldo Antunes', - 'estadoCivil' => 'solteiro', - 'doador' => TRUE - )); - - // Marca como se tivesse sido carregado, para garantir a comparação - $expected->markOld(); - - $this->assertEquals($expected, $found[0]); - } - - public function testCadastraNovoRegistro() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - - $entity = new CoreExt_EntityStub(array( - 'nome' => 'Fernando Nascimento', - 'estadoCivil' => 'solteiro', - 'doador' => TRUE - )); - - $mapper->save($entity); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('pessoa-depois-salvo.xml')) - ->getTable('pessoa'), - $this->getConnection() - ->createDataSet() - ->getTable('pessoa') - ); - } - - public function testAtualizaRegistroCasoAChavePrimariaEstejaSetada() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - - $entity = new CoreExt_EntityStub(array( - 'id' => 2, - 'nome' => 'Marvin Gaye', - 'estadoCivil' => 'solteiro', - 'doador' => NULL - )); - - $mapper->save($entity); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('pessoa-depois-atualizado.xml')) - ->getTable('pessoa'), - $this->getConnection() - ->createDataSet() - ->getTable('pessoa') - ); - } - - /** - * @expectedException Exception - */ - public function testCadastraNovoRegistroLancaExcecaoNaoVerificadaNosErrosDeValidacao() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - - $entity = new CoreExt_EntityStub(array( - 'nome' => '', - 'estadoCivil' => 'solteiro', - 'doador' => TRUE - )); - - $mapper->save($entity); - } - - public function testAtualizaRegistro() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - $entity = $mapper->find(2); - $entity->estadoCivil = 'solteiro'; - $entity->doador = ''; - - $mapper->save($entity); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('pessoa-depois-atualizado.xml')) - ->getTable('pessoa'), - $this->getConnection() - ->createDataSet() - ->getTable('pessoa') - ); - } - - public function testApagaRegistroUsandoInstanciaDeEntity() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - $entity = $mapper->find(1); - - $mapper->delete($entity); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('pessoa-depois-removido.xml')) - ->getTable('pessoa'), - $this->getConnection() - ->createDataSet() - ->getTable('pessoa') - ); - } - - public function testApagaRegistroUsandoValorInteiro() - { - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter()); - $mapper->delete(1); - - $this->assertTablesEqual( - $this->createXMLDataSet($this->getFixture('pessoa-depois-removido.xml')) - ->getTable('pessoa'), - $this->getConnection() - ->createDataSet() - ->getTable('pessoa') - ); - } -} \ No newline at end of file diff --git a/ieducar/tests/unit/CoreExt/DataMapper/LazyLoadIntegrationTest.php b/ieducar/tests/unit/CoreExt/DataMapper/LazyLoadIntegrationTest.php deleted file mode 100644 index ad26ba0..0000000 --- a/ieducar/tests/unit/CoreExt/DataMapper/LazyLoadIntegrationTest.php +++ /dev/null @@ -1,190 +0,0 @@ - - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Arquivo disponível desde a versão 1.1.0 - * @version $Id$ - */ - -require_once 'CoreExt/_stub/ParentEntityDataMapper.php'; -require_once 'CoreExt/_stub/ChildEntityDataMapper.php'; - -/** - * CoreExt_DataMapper_LazyLoadIntegrationTest class. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Classe disponível desde a versão 1.1.0 - * @version @@package_version@@ - */ -class CoreExt_DataMapper_LazyLoadIntegrationTest extends IntegrationBaseTest -{ - /** - * Cria as tabelas parent e child. - */ - public function __construct() - { - parent::__construct(); - CoreExt_DataMapper::setDefaultDbAdapter($this->getDbAdapter()); - CoreExt_ParentEntityDataMapperStub::createTable($this->getDbAdapter()); - CoreExt_ChildEntityDataMapperStub::createTable($this->getDbAdapter()); - } - - public function setUp() - { - parent::setUp(); - CoreExt_DataMapper::setDefaultDbAdapter($this->getDbAdapter()); - } - - public function getDataSet() - { - return $this->createXMLDataSet($this->getFixture('parent-child.xml')); - } - - public function testRecuperaTodosOsRegistros() - { - $mapper = new CoreExt_ParentEntityDataMapperStub(); - $found = $mapper->findAll(); - - $this->assertTablesEqual( - $this->getDataSet() - ->getTable('parent'), - $this->getConnection() - ->createDataSet() - ->getTable('parent') - ); - - $this->assertTablesEqual( - $this->getDataSet() - ->getTable('child'), - $this->getConnection() - ->createDataSet() - ->getTable('child') - ); - } - - public function testLazyLoadUsandoDefinicaoDeDataMapper() - { - $definition = array( - 'class' => 'CoreExt_ChildEntityDataMapperStub', - 'file' => 'CoreExt/_stub/ChildEntityDataMapper.php' - ); - - $parentMapper = new CoreExt_ParentEntityDataMapperStub(); - $parent = $parentMapper->find(1); - $parent->setReference('filho', $definition); - - $this->assertEquals(1, $parent->filho->id); - $this->assertEquals('Antunes Jr.', $parent->filho->nome); - } - - /** - * Uma referência NULL para CoreExt_Enum retorna NULL logo no início da - * lógica de CoreExt_Entity::_loadReference(). - * @group CoreExt_Entity - */ - public function testLazyLoadUsandoDefinicaoDeEnumComReferenciaNula() - { - $child = new CoreExt_ChildEntityStub( - array('id' => 3, 'sexo' => 1, 'tipoSanguineo' => NULL) - ); - $this->assertNull($child->tipoSanguineo); - } - - /** - * Referência 0 é perfeitamente válido para um CoreExt_Enum. Se não existir o - * offset no Enum, retorna NULL - * @group CoreExt_Entity - */ - public function testLazyLoadUsandoDefinicaoDeEnumComReferenciaZero() - { - $child = new CoreExt_ChildEntityStub( - array('id' => 3, 'sexo' => 1, 'tipoSanguineo' => 0) - ); - $this->assertNull($child->tipoSanguineo); - } - - /** - * Uma referência NULL é válida para as referências que explicitam a chave - * null = TRUE. - * @group CoreExt_Entity - */ - public function testLazyLoadUsandoDefinicaoDeDataMapperComReferenciaNula() - { - $parent = new CoreExt_ParentEntityStub( - array('id' => 3, 'nome' => 'Paul M.', 'filho' => NULL) - ); - $this->assertNull($parent->filho); - } - - /** - * Referência 0 em DataMapper força o retorno de NULL. Isso é feito em - * razão do HTML não suportar um valor NULL e por conta dos validadores - * client-side legados do i-Educar não considerarem "" (string vazia) um - * valor válido para submit. - * @group CoreExt_Entity - */ - public function testLazyLoadUsandoDefinicaoDeDataMapperComReferenciaZero() - { - $parent = new CoreExt_ParentEntityStub( - array('id' => 3, 'nome' => 'Paul M.', 'filho' => 0) - ); - $this->assertNull($parent->filho); - } - - public function testInsereRegistros() - { - $child = new CoreExt_ChildEntityStub(array('nome' => 'Nascimento Jr.')); - $childMapper = new CoreExt_ChildEntityDataMapperStub(); - $childMapper->save($child); - - $parent = new CoreExt_ParentEntityStub(array('nome' => 'Fernando Nascimento', 'filho' => 3)); - $parentMapper = new CoreExt_ParentEntityDataMapperStub(); - $parentMapper->save($parent); - - $parent = $parentMapper->find(3); - $child = $childMapper->find(3); - - $this->assertEquals($child, $parent->filho); - } - - /** - * Testa se um CoreExt_Entity retornado por um CoreExt_DataMapper configura - * a reference e o atributo, com um valor referência e a instância, - * respectivamente. - * @group Overload - */ - public function testRegistroRecuperadoConfiguraReferenceParaLazyLoadPosterior() - { - $parentMapper = new CoreExt_ParentEntityDataMapperStub(); - $parent = $parentMapper->find(1); - $this->assertEquals(1, $parent->get('filho')); - $this->assertType('CoreExt_ChildEntityStub', $parent->filho); - } -} \ No newline at end of file diff --git a/ieducar/tests/unit/CoreExt/DataMapper/StaticAdapterTest.php b/ieducar/tests/unit/CoreExt/DataMapper/StaticAdapterTest.php deleted file mode 100644 index b9c0226..0000000 --- a/ieducar/tests/unit/CoreExt/DataMapper/StaticAdapterTest.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) - * qualquer versão posterior. - * - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral - * do GNU para mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto - * com este programa; se não, escreva para a Free Software Foundation, Inc., no - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Arquivo disponível desde a versão 1.1.0 - * @version $Id$ - */ - -require_once 'CoreExt/_stub/EntityDataMapper.php'; - -/** - * CoreExt_DataMapper_StaticAdapterTest class. - * - * Classe com testes para assegurar que a interface de configuração de adapter - * de banco de dados estática de CoreExt_DataMapper funciona. - * - * @author Eriksen Costa Paixão - * @category i-Educar - * @license @@license@@ - * @package CoreExt_DataMapper - * @subpackage IntegrationTests - * @since Classe disponível desde a versão 1.1.0 - * @version @@package_version@@ - */ -class CoreExt_DataMapper_StaticAdapterTest extends IntegrationBaseTest -{ - protected function setUp() - { - parent::setUp(); - CoreExt_DataMapper::setDefaultDbAdapter($this->getDbAdapter()); - } - - protected function tearDown() - { - parent::tearDown(); - CoreExt_DataMapper::resetDefaultDbAdapter(); - } - - public function getSetUpOperation() - { - return PHPUnit_Extensions_Database_Operation_Factory::NONE(); - } - - /** - * Esse método precisa ser sobrescrito mas a utilidade dele nesse teste é - * irrelevante. - */ - public function getDataSet() - { - return $this->createXMLDataSet($this->getFixture('pessoa.xml')); - } - - public function testAdapterParaNovaInstanciaDeDataMapperEOStatic() - { - $entityMapper = new CoreExt_EntityDataMapperStub(); - $this->assertSame($this->getDbAdapter(), $entityMapper->getDbAdapter()); - - $entityMapper = new CoreExt_EntityDataMapperStub(); - $this->assertSame($this->getDbAdapter(), $entityMapper->getDbAdapter()); - } - - public function testAdapterNoConstrutorSobrescreveOAdapterStaticPadrao() - { - $db = new CustomPdo('sqlite::memory:'); - $entityMapper = new CoreExt_EntityDataMapperStub($db); - $this->assertSame($db, $entityMapper->getDbAdapter()); - } - - public function testResetarAdapterFazComQueODataMapperInstancieUmNovoAdapter() - { - CoreExt_EntityDataMapperStub::resetDefaultDbAdapter(); - $entityMapper = new CoreExt_EntityDataMapperStub(); - $this->assertNotSame($this->getDbAdapter(), $entityMapper->getDbAdapter()); - } -} \ No newline at end of file -- libgit2 0.21.2