Repository navigation
Expand file tree
/
Copy pathGuiaTest.php
More file actions
96 lines (89 loc) · 2.43 KB
/
Copy pathGuiaTest.php
File metadata and controls
96 lines (89 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
*
* @author Caio Lucena <caioflucena@gmail.com>
* @todo Criar uma guia apos finalizar os testes, deixando assim a mesma para o teste de questao
*/
class GuiaTest extends PHPUnit_Framework_TestCase
{
/**
*
*/
protected function tearDown()
{
$guiaModel = new GuiaModel();
$result = $guiaModel->pesquisarPorEditalModuloCategoria(1);
$reflection = new ReflectionObject($guiaModel);
$property = $reflection->getProperty('table');
$property->setAccessible(true);
$table = $property->getValue($guiaModel);
$select = $table->select()->setIntegrityCheck(false)->from('tbGuia', 'idGuia')->where('nmGuia = ?', 'Guia teste');
$result = $table->fetchAll($select)->toArray();
foreach ($result as $guia) {
$table->delete(array('idGuia = ?' => $guia['idGuia']));
}
}
/**
*
*/
public function testCadastrar()
{
$GuiaModel = new GuiaModel(
null,
1,
'Guia teste',
'Texto Guia teste'
);
$GuiaModel->cadastrar();
$guia = $GuiaModel->toStdClass();
$this->assertNotNull($guia->guia);
}
/**
* @expectedException Exception
*/
public function testCadastrarValidar()
{
$GuiaModel = new GuiaModel();
$GuiaModel->cadastrar();
}
/**
*
*/
public function testPesquisarPorCategoria()
{
$this->testCadastrar();
$GuiaModel = new GuiaModel();
$result = $GuiaModel->pesquisarPorEditalModuloCategoria(1);
$this->assertNotEmpty($result);
}
/**
*
*/
public function testPesquisarPorModulo()
{
$this->testCadastrar();
$GuiaModel = new GuiaModel();
$result = $GuiaModel->pesquisarPorEditalModuloCategoria(null, 1007);
$this->assertNotEmpty($result);
}
/**
*
*/
public function testPesquisarPorEdital()
{
$this->testCadastrar();
$GuiaModel = new GuiaModel();
$result = $GuiaModel->pesquisarPorEditalModuloCategoria(null, null, 2068);
$this->assertNotEmpty($result);
}
/**
*
*/
public function testPesquisarPorEditalModuloCategoria()
{
$this->testCadastrar();
$GuiaModel = new GuiaModel();
$result = $GuiaModel->pesquisarPorEditalModuloCategoria(1, 1007, 2068);
$this->assertNotEmpty($result);
}
}