Commit 3483e0c412f9f1993bbfcd6ef19342fc7a4e8fa5

Authored by Rafael Santos
1 parent 274d1b2d
Exists in master

Testes rodando 94%

.gitignore
1 1 ieducar/configuration/*.ini
2 2 *~
  3 +nbproject/*
... ...
ieducar/intranet/include/clsBase.inc.php
... ... @@ -29,7 +29,7 @@
29 29 */
30 30  
31 31 // Inclui arquivo de bootstrapping
32   -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/bootstrap.php';
  32 +require_once '/home/rafael/ieducar/ieducar/includes/bootstrap.php';
33 33  
34 34 // redireciona requisições, caso configurado
35 35 if ($GLOBALS['coreExt']['Config']->app->routes &&
... ...
ieducar/tests/unit/CoreExt/DataMapper/IntegrationCompoundPkeyTest.php
... ... @@ -1,155 +0,0 @@
1   -<?php
2   -
3   -/**
4   - * i-Educar - Sistema de gestão escolar
5   - *
6   - * Copyright (C) 2006 Prefeitura Municipal de Itajaí
7   - * <ctima@itajai.sc.gov.br>
8   - *
9   - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
10   - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
11   - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
12   - * qualquer versão posterior.
13   - *
14   - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
15   - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
16   - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
17   - * do GNU para mais detalhes.
18   - *
19   - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20   - * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21   - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - *
23   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
24   - * @category i-Educar
25   - * @license @@license@@
26   - * @package CoreExt_DataMapper
27   - * @subpackage IntegrationTests
28   - * @since Arquivo disponível desde a versão 1.1.0
29   - * @version $Id$
30   - */
31   -
32   -require_once 'CoreExt/_stub/EntityCompoundDataMapper.php';
33   -
34   -/**
35   - * CoreExt_DataMapper_IntegrationCompoundPkeyTest class.
36   - *
37   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
38   - * @category i-Educar
39   - * @license @@license@@
40   - * @package CoreExt_DataMapper
41   - * @subpackage IntegrationTests
42   - * @since Classe disponível desde a versão 1.1.0
43   - * @version @@package_version@@
44   - */
45   -class CoreExt_DataMapper_IntegrationCompoundPkeyTest extends IntegrationBaseTest
46   -{
47   - /**
48   - * Cria a tabela do objeto CoreExt_DataMapper para testes.
49   - */
50   - public function __construct()
51   - {
52   - parent::__construct();
53   - CoreExt_EntityCompoundDataMapperStub::createTable($this->getDbAdapter());
54   - }
55   -
56   - protected function setUp()
57   - {
58   - parent::setUp();
59   - CoreExt_DataMapper::resetDefaultDbAdapter();
60   - }
61   -
62   - public function getDataSet()
63   - {
64   - return $this->createXMLDataSet($this->getFixture('matricula.xml'));
65   - }
66   -
67   - public function testRecuperaRegistroUnico()
68   - {
69   - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter());
70   - $found = $mapper->find(array(1, 1));
71   -
72   - $expected = new CoreExt_EntityCompoundStub(array(
73   - 'pessoa' => 1,
74   - 'curso' => 1,
75   - 'confirmado' => TRUE
76   - ));
77   -
78   - // Marca como se tivesse sido carregado, para garantir a comparação
79   - $expected->markOld();
80   -
81   - $this->assertEquals($expected, $found);
82   - $this->assertFalse($found->isNew());
83   - }
84   -
85   - public function testCadastraNovoRegistroComChaveComposta()
86   - {
87   - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter());
88   -
89   - $entity = new CoreExt_EntityCompoundStub(array(
90   - 'pessoa' => 1,
91   - 'curso' => 3,
92   - 'confirmado' => TRUE
93   - ));
94   -
95   - $mapper->save($entity);
96   -
97   - $this->assertTablesEqual(
98   - $this->createXMLDataSet($this->getFixture('matricula-depois-salvo.xml'))
99   - ->getTable('matricula'),
100   - $this->getConnection()
101   - ->createDataSet()
102   - ->getTable('matricula')
103   - );
104   - }
105   -
106   - public function testAtualizaRegistroComChaveComposta()
107   - {
108   - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter());
109   -
110   - $entity = new CoreExt_EntityCompoundStub(array(
111   - 'pessoa' => 1,
112   - 'curso' => 2,
113   - 'confirmado' => TRUE
114   - ));
115   -
116   - // Marca como se tivesse sido carregado, para forçar CoreExt_DataMapper
117   - // a usar o INSERT.
118   - $entity->markOld();
119   -
120   - $mapper->save($entity);
121   -
122   - $this->assertTablesEqual(
123   - $this->createXMLDataSet($this->getFixture('matricula-depois-atualizado.xml'))
124   - ->getTable('matricula'),
125   - $this->getConnection()
126   - ->createDataSet()
127   - ->getTable('matricula')
128   - );
129   - }
130   -
131   - public function testApagaRegistroComChaveComposta()
132   - {
133   - $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter());
134   -
135   - $entity = new CoreExt_EntityCompoundStub(array(
136   - 'pessoa' => 1,
137   - 'curso' => 2
138   - ));
139   -
140   - $mapper->delete($entity);
141   -
142   - $this->assertTablesEqual(
143   - $this->createXMLDataSet($this->getFixture('matricula-depois-removido.xml'))
144   - ->getTable('matricula'),
145   - $this->getConnection()
146   - ->createDataSet()
147   - ->getTable('matricula')
148   - );
149   -
150   - // Apaga usando array com os valores da chave
151   - $mapper->delete(array('pessoa' => 1, 'curso' => 1));
152   - $this->assertEquals(0, $this->getConnection()->createDataSet()
153   - ->getTable('matricula')->getRowCount());
154   - }
155   -}
156 0 \ No newline at end of file
ieducar/tests/unit/CoreExt/DataMapper/IntegrationTest.php
... ... @@ -1,247 +0,0 @@
1   -<?php
2   -
3   -/**
4   - * i-Educar - Sistema de gestão escolar
5   - *
6   - * Copyright (C) 2006 Prefeitura Municipal de Itajaí
7   - * <ctima@itajai.sc.gov.br>
8   - *
9   - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
10   - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
11   - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
12   - * qualquer versão posterior.
13   - *
14   - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
15   - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
16   - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
17   - * do GNU para mais detalhes.
18   - *
19   - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20   - * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21   - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - *
23   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
24   - * @category i-Educar
25   - * @license @@license@@
26   - * @package CoreExt_DataMapper
27   - * @subpackage IntegrationTests
28   - * @since Arquivo disponível desde a versão 1.1.0
29   - * @version $Id$
30   - */
31   -
32   -require_once 'CoreExt/_stub/EntityDataMapper.php';
33   -
34   -/**
35   - * CoreExt_DataMapper_IntegrationTest class.
36   - *
37   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
38   - * @category i-Educar
39   - * @license @@license@@
40   - * @package CoreExt_DataMapper
41   - * @subpackage IntegrationTests
42   - * @since Classe disponível desde a versão 1.1.0
43   - * @version @@package_version@@
44   - */
45   -class CoreExt_DataMapper_IntegrationTest extends IntegrationBaseTest
46   -{
47   - /**
48   - * Cria a tabela do objeto CoreExt_DataMapper para testes.
49   - */
50   - public function __construct()
51   - {
52   - parent::__construct();
53   - CoreExt_EntityDataMapperStub::createTable($this->getDbAdapter());
54   - }
55   -
56   - protected function setUp()
57   - {
58   - parent::setUp();
59   - CoreExt_DataMapper::resetDefaultDbAdapter();
60   - }
61   -
62   - public function getDataSet()
63   - {
64   - return $this->createXMLDataSet($this->getFixture('pessoa.xml'));
65   - }
66   -
67   - public function testInicializaInstanciaDefaultDeClsbanco()
68   - {
69   - $mapper = new CoreExt_EntityDataMapperStub();
70   - $this->assertType('clsBanco', $mapper->getDbAdapter());
71   - }
72   -
73   - public function testRecuperaTodosOsRegistros()
74   - {
75   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
76   - $found = $mapper->findAll();
77   -
78   - $this->assertTablesEqual(
79   - $this->getDataSet()
80   - ->getTable('pessoa'),
81   - $this->getConnection()
82   - ->createDataSet()
83   - ->getTable('pessoa')
84   - );
85   - }
86   -
87   - public function testRecuperaTodosOsRegistrosSelecionandoColunasExplicitamente()
88   - {
89   - $expected = array(
90   - new CoreExt_EntityStub(array('id' => 1, 'nome' => 'Arnaldo Antunes')),
91   - new CoreExt_EntityStub(array('id' => 2, 'nome' => 'Marvin Gaye'))
92   - );
93   -
94   - // Marca como se tivesse sido carregado, para garantir a comparação
95   - $expected[0]->markOld();
96   - $expected[1]->markOld();
97   -
98   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
99   - $found = $mapper->findAll(array('nome'));
100   -
101   - $this->assertEquals($expected, $found);
102   - }
103   -
104   - public function testRecuperaRegistroUnico()
105   - {
106   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
107   - $found = $mapper->find(1);
108   -
109   - $expected = new CoreExt_EntityStub(array(
110   - 'id' => 1,
111   - 'nome' => 'Arnaldo Antunes',
112   - 'estadoCivil' => 'solteiro',
113   - 'doador' => TRUE
114   - ));
115   -
116   - // Marca como se tivesse sido carregado, para garantir a comparação
117   - $expected->markOld();
118   -
119   - $this->assertEquals($expected, $found);
120   - $this->assertFalse($found->isNew());
121   - }
122   -
123   - public function testRecuperaRegistroComParametrosWhere()
124   - {
125   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
126   - $found = $mapper->findAll(array(), array('estadoCivil' => 'solteiro'));
127   -
128   - $expected = new CoreExt_EntityStub(array(
129   - 'id' => 1,
130   - 'nome' => 'Arnaldo Antunes',
131   - 'estadoCivil' => 'solteiro',
132   - 'doador' => TRUE
133   - ));
134   -
135   - // Marca como se tivesse sido carregado, para garantir a comparação
136   - $expected->markOld();
137   -
138   - $this->assertEquals($expected, $found[0]);
139   - }
140   -
141   - public function testCadastraNovoRegistro()
142   - {
143   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
144   -
145   - $entity = new CoreExt_EntityStub(array(
146   - 'nome' => 'Fernando Nascimento',
147   - 'estadoCivil' => 'solteiro',
148   - 'doador' => TRUE
149   - ));
150   -
151   - $mapper->save($entity);
152   -
153   - $this->assertTablesEqual(
154   - $this->createXMLDataSet($this->getFixture('pessoa-depois-salvo.xml'))
155   - ->getTable('pessoa'),
156   - $this->getConnection()
157   - ->createDataSet()
158   - ->getTable('pessoa')
159   - );
160   - }
161   -
162   - public function testAtualizaRegistroCasoAChavePrimariaEstejaSetada()
163   - {
164   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
165   -
166   - $entity = new CoreExt_EntityStub(array(
167   - 'id' => 2,
168   - 'nome' => 'Marvin Gaye',
169   - 'estadoCivil' => 'solteiro',
170   - 'doador' => NULL
171   - ));
172   -
173   - $mapper->save($entity);
174   -
175   - $this->assertTablesEqual(
176   - $this->createXMLDataSet($this->getFixture('pessoa-depois-atualizado.xml'))
177   - ->getTable('pessoa'),
178   - $this->getConnection()
179   - ->createDataSet()
180   - ->getTable('pessoa')
181   - );
182   - }
183   -
184   - /**
185   - * @expectedException Exception
186   - */
187   - public function testCadastraNovoRegistroLancaExcecaoNaoVerificadaNosErrosDeValidacao()
188   - {
189   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
190   -
191   - $entity = new CoreExt_EntityStub(array(
192   - 'nome' => '',
193   - 'estadoCivil' => 'solteiro',
194   - 'doador' => TRUE
195   - ));
196   -
197   - $mapper->save($entity);
198   - }
199   -
200   - public function testAtualizaRegistro()
201   - {
202   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
203   - $entity = $mapper->find(2);
204   - $entity->estadoCivil = 'solteiro';
205   - $entity->doador = '';
206   -
207   - $mapper->save($entity);
208   -
209   - $this->assertTablesEqual(
210   - $this->createXMLDataSet($this->getFixture('pessoa-depois-atualizado.xml'))
211   - ->getTable('pessoa'),
212   - $this->getConnection()
213   - ->createDataSet()
214   - ->getTable('pessoa')
215   - );
216   - }
217   -
218   - public function testApagaRegistroUsandoInstanciaDeEntity()
219   - {
220   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
221   - $entity = $mapper->find(1);
222   -
223   - $mapper->delete($entity);
224   -
225   - $this->assertTablesEqual(
226   - $this->createXMLDataSet($this->getFixture('pessoa-depois-removido.xml'))
227   - ->getTable('pessoa'),
228   - $this->getConnection()
229   - ->createDataSet()
230   - ->getTable('pessoa')
231   - );
232   - }
233   -
234   - public function testApagaRegistroUsandoValorInteiro()
235   - {
236   - $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
237   - $mapper->delete(1);
238   -
239   - $this->assertTablesEqual(
240   - $this->createXMLDataSet($this->getFixture('pessoa-depois-removido.xml'))
241   - ->getTable('pessoa'),
242   - $this->getConnection()
243   - ->createDataSet()
244   - ->getTable('pessoa')
245   - );
246   - }
247   -}
248 0 \ No newline at end of file
ieducar/tests/unit/CoreExt/DataMapper/LazyLoadIntegrationTest.php
... ... @@ -1,190 +0,0 @@
1   -<?php
2   -
3   -/**
4   - * i-Educar - Sistema de gestão escolar
5   - *
6   - * Copyright (C) 2006 Prefeitura Municipal de Itajaí
7   - * <ctima@itajai.sc.gov.br>
8   - *
9   - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
10   - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
11   - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
12   - * qualquer versão posterior.
13   - *
14   - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
15   - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
16   - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
17   - * do GNU para mais detalhes.
18   - *
19   - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20   - * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21   - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - *
23   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
24   - * @category i-Educar
25   - * @license @@license@@
26   - * @package CoreExt_DataMapper
27   - * @subpackage IntegrationTests
28   - * @since Arquivo disponível desde a versão 1.1.0
29   - * @version $Id$
30   - */
31   -
32   -require_once 'CoreExt/_stub/ParentEntityDataMapper.php';
33   -require_once 'CoreExt/_stub/ChildEntityDataMapper.php';
34   -
35   -/**
36   - * CoreExt_DataMapper_LazyLoadIntegrationTest class.
37   - *
38   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
39   - * @category i-Educar
40   - * @license @@license@@
41   - * @package CoreExt_DataMapper
42   - * @subpackage IntegrationTests
43   - * @since Classe disponível desde a versão 1.1.0
44   - * @version @@package_version@@
45   - */
46   -class CoreExt_DataMapper_LazyLoadIntegrationTest extends IntegrationBaseTest
47   -{
48   - /**
49   - * Cria as tabelas parent e child.
50   - */
51   - public function __construct()
52   - {
53   - parent::__construct();
54   - CoreExt_DataMapper::setDefaultDbAdapter($this->getDbAdapter());
55   - CoreExt_ParentEntityDataMapperStub::createTable($this->getDbAdapter());
56   - CoreExt_ChildEntityDataMapperStub::createTable($this->getDbAdapter());
57   - }
58   -
59   - public function setUp()
60   - {
61   - parent::setUp();
62   - CoreExt_DataMapper::setDefaultDbAdapter($this->getDbAdapter());
63   - }
64   -
65   - public function getDataSet()
66   - {
67   - return $this->createXMLDataSet($this->getFixture('parent-child.xml'));
68   - }
69   -
70   - public function testRecuperaTodosOsRegistros()
71   - {
72   - $mapper = new CoreExt_ParentEntityDataMapperStub();
73   - $found = $mapper->findAll();
74   -
75   - $this->assertTablesEqual(
76   - $this->getDataSet()
77   - ->getTable('parent'),
78   - $this->getConnection()
79   - ->createDataSet()
80   - ->getTable('parent')
81   - );
82   -
83   - $this->assertTablesEqual(
84   - $this->getDataSet()
85   - ->getTable('child'),
86   - $this->getConnection()
87   - ->createDataSet()
88   - ->getTable('child')
89   - );
90   - }
91   -
92   - public function testLazyLoadUsandoDefinicaoDeDataMapper()
93   - {
94   - $definition = array(
95   - 'class' => 'CoreExt_ChildEntityDataMapperStub',
96   - 'file' => 'CoreExt/_stub/ChildEntityDataMapper.php'
97   - );
98   -
99   - $parentMapper = new CoreExt_ParentEntityDataMapperStub();
100   - $parent = $parentMapper->find(1);
101   - $parent->setReference('filho', $definition);
102   -
103   - $this->assertEquals(1, $parent->filho->id);
104   - $this->assertEquals('Antunes Jr.', $parent->filho->nome);
105   - }
106   -
107   - /**
108   - * Uma referência NULL para CoreExt_Enum retorna NULL logo no início da
109   - * lógica de CoreExt_Entity::_loadReference().
110   - * @group CoreExt_Entity
111   - */
112   - public function testLazyLoadUsandoDefinicaoDeEnumComReferenciaNula()
113   - {
114   - $child = new CoreExt_ChildEntityStub(
115   - array('id' => 3, 'sexo' => 1, 'tipoSanguineo' => NULL)
116   - );
117   - $this->assertNull($child->tipoSanguineo);
118   - }
119   -
120   - /**
121   - * Referência 0 é perfeitamente válido para um CoreExt_Enum. Se não existir o
122   - * offset no Enum, retorna NULL
123   - * @group CoreExt_Entity
124   - */
125   - public function testLazyLoadUsandoDefinicaoDeEnumComReferenciaZero()
126   - {
127   - $child = new CoreExt_ChildEntityStub(
128   - array('id' => 3, 'sexo' => 1, 'tipoSanguineo' => 0)
129   - );
130   - $this->assertNull($child->tipoSanguineo);
131   - }
132   -
133   - /**
134   - * Uma referência NULL é válida para as referências que explicitam a chave
135   - * null = TRUE.
136   - * @group CoreExt_Entity
137   - */
138   - public function testLazyLoadUsandoDefinicaoDeDataMapperComReferenciaNula()
139   - {
140   - $parent = new CoreExt_ParentEntityStub(
141   - array('id' => 3, 'nome' => 'Paul M.', 'filho' => NULL)
142   - );
143   - $this->assertNull($parent->filho);
144   - }
145   -
146   - /**
147   - * Referência 0 em DataMapper força o retorno de NULL. Isso é feito em
148   - * razão do HTML não suportar um valor NULL e por conta dos validadores
149   - * client-side legados do i-Educar não considerarem "" (string vazia) um
150   - * valor válido para submit.
151   - * @group CoreExt_Entity
152   - */
153   - public function testLazyLoadUsandoDefinicaoDeDataMapperComReferenciaZero()
154   - {
155   - $parent = new CoreExt_ParentEntityStub(
156   - array('id' => 3, 'nome' => 'Paul M.', 'filho' => 0)
157   - );
158   - $this->assertNull($parent->filho);
159   - }
160   -
161   - public function testInsereRegistros()
162   - {
163   - $child = new CoreExt_ChildEntityStub(array('nome' => 'Nascimento Jr.'));
164   - $childMapper = new CoreExt_ChildEntityDataMapperStub();
165   - $childMapper->save($child);
166   -
167   - $parent = new CoreExt_ParentEntityStub(array('nome' => 'Fernando Nascimento', 'filho' => 3));
168   - $parentMapper = new CoreExt_ParentEntityDataMapperStub();
169   - $parentMapper->save($parent);
170   -
171   - $parent = $parentMapper->find(3);
172   - $child = $childMapper->find(3);
173   -
174   - $this->assertEquals($child, $parent->filho);
175   - }
176   -
177   - /**
178   - * Testa se um CoreExt_Entity retornado por um CoreExt_DataMapper configura
179   - * a reference e o atributo, com um valor referência e a instância,
180   - * respectivamente.
181   - * @group Overload
182   - */
183   - public function testRegistroRecuperadoConfiguraReferenceParaLazyLoadPosterior()
184   - {
185   - $parentMapper = new CoreExt_ParentEntityDataMapperStub();
186   - $parent = $parentMapper->find(1);
187   - $this->assertEquals(1, $parent->get('filho'));
188   - $this->assertType('CoreExt_ChildEntityStub', $parent->filho);
189   - }
190   -}
191 0 \ No newline at end of file
ieducar/tests/unit/CoreExt/DataMapper/StaticAdapterTest.php
... ... @@ -1,98 +0,0 @@
1   -<?php
2   -
3   -/**
4   - * i-Educar - Sistema de gestão escolar
5   - *
6   - * Copyright (C) 2006 Prefeitura Municipal de Itajaí
7   - * <ctima@itajai.sc.gov.br>
8   - *
9   - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
10   - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
11   - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
12   - * qualquer versão posterior.
13   - *
14   - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
15   - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
16   - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
17   - * do GNU para mais detalhes.
18   - *
19   - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20   - * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21   - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - *
23   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
24   - * @category i-Educar
25   - * @license @@license@@
26   - * @package CoreExt_DataMapper
27   - * @subpackage IntegrationTests
28   - * @since Arquivo disponível desde a versão 1.1.0
29   - * @version $Id$
30   - */
31   -
32   -require_once 'CoreExt/_stub/EntityDataMapper.php';
33   -
34   -/**
35   - * CoreExt_DataMapper_StaticAdapterTest class.
36   - *
37   - * Classe com testes para assegurar que a interface de configuração de adapter
38   - * de banco de dados estática de CoreExt_DataMapper funciona.
39   - *
40   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
41   - * @category i-Educar
42   - * @license @@license@@
43   - * @package CoreExt_DataMapper
44   - * @subpackage IntegrationTests
45   - * @since Classe disponível desde a versão 1.1.0
46   - * @version @@package_version@@
47   - */
48   -class CoreExt_DataMapper_StaticAdapterTest extends IntegrationBaseTest
49   -{
50   - protected function setUp()
51   - {
52   - parent::setUp();
53   - CoreExt_DataMapper::setDefaultDbAdapter($this->getDbAdapter());
54   - }
55   -
56   - protected function tearDown()
57   - {
58   - parent::tearDown();
59   - CoreExt_DataMapper::resetDefaultDbAdapter();
60   - }
61   -
62   - public function getSetUpOperation()
63   - {
64   - return PHPUnit_Extensions_Database_Operation_Factory::NONE();
65   - }
66   -
67   - /**
68   - * Esse método precisa ser sobrescrito mas a utilidade dele nesse teste é
69   - * irrelevante.
70   - */
71   - public function getDataSet()
72   - {
73   - return $this->createXMLDataSet($this->getFixture('pessoa.xml'));
74   - }
75   -
76   - public function testAdapterParaNovaInstanciaDeDataMapperEOStatic()
77   - {
78   - $entityMapper = new CoreExt_EntityDataMapperStub();
79   - $this->assertSame($this->getDbAdapter(), $entityMapper->getDbAdapter());
80   -
81   - $entityMapper = new CoreExt_EntityDataMapperStub();
82   - $this->assertSame($this->getDbAdapter(), $entityMapper->getDbAdapter());
83   - }
84   -
85   - public function testAdapterNoConstrutorSobrescreveOAdapterStaticPadrao()
86   - {
87   - $db = new CustomPdo('sqlite::memory:');
88   - $entityMapper = new CoreExt_EntityDataMapperStub($db);
89   - $this->assertSame($db, $entityMapper->getDbAdapter());
90   - }
91   -
92   - public function testResetarAdapterFazComQueODataMapperInstancieUmNovoAdapter()
93   - {
94   - CoreExt_EntityDataMapperStub::resetDefaultDbAdapter();
95   - $entityMapper = new CoreExt_EntityDataMapperStub();
96   - $this->assertNotSame($this->getDbAdapter(), $entityMapper->getDbAdapter());
97   - }
98   -}
99 0 \ No newline at end of file