object = new IgepComunicacion; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. * * @access protected */ protected function tearDown() { } /** * @todo Implement testData2Arrays(). */ public function testData2Arrays() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArraySeleccionar(). */ public function testConstruirArraySeleccionar() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArrayBorrar(). */ public function testConstruirArrayBorrar() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test_limpiarRequest(). */ public function test_limpiarRequest() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test_getPosicionRegistroPantalla(). */ public function test_getPosicionRegistroPantalla() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArrayBuscar(). */ public function testConstruirArrayBuscar() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArrayIniciarVentana(). */ public function testConstruirArrayIniciarVentana() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testBuildDataRefreshUI(). */ public function testBuildDataRefreshUI() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArrayOrdenarTabla(). */ public function testConstruirArrayOrdenarTabla() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArrayFocusChanged(). */ public function testConstruirArrayFocusChanged() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArrayAbrirVentanaSeleccion(). */ public function testConstruirArrayAbrirVentanaSeleccion() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConstruirArrayBuscarVentanaSeleccion(). */ public function testConstruirArrayBuscarVentanaSeleccion() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testCheckDataTypes(). */ public function testCheckDataTypes() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDameDatos(). */ public function testDameDatos() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDameDatosAntiguos(). */ public function testDameDatosAntiguos() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDameFilaActual(). */ public function testDameFilaActual() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDamePanelActivo(). */ public function testDamePanelActivo() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testReset(). */ public function testReset() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetOperation(). */ public function testSetOperation() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetArrayOperacion(). */ public function testSetArrayOperacion() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetOperation(). */ public function testGetOperation() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetIndex(). */ public function testGetIndex() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testPosicionarEnTupla(). */ public function testPosicionarEnTupla() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test_next(). */ public function test_next() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test_getIndiceInterno(). */ public function test_getIndiceInterno() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testCurrentTupla(). */ public function testCurrentTupla() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetCampo(). */ public function testGetCampo() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetOldValue(). */ public function testGetOldValue() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetCampo(). */ public function testSetCampo() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFetchTupla(). */ public function testFetchTupla() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testNextTupla(). */ public function testNextTupla() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetTupla(). */ public function testSetTupla() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetAllTuplas(). */ public function testGetAllTuplas() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetAllTuplasAntiguas(). */ public function testGetAllTuplasAntiguas() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetAllTuplas(). */ public function testSetAllTuplas() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test_setAllTuplasAntiguas(). */ public function test_setAllTuplasAntiguas() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetList(). */ public function testSetList() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testIsEmpty(). */ public function testIsEmpty() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetFileInfo(). */ public function testGetFileInfo() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetMapping(). */ public function testSetMapping() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetForward(). */ public function testGetForward() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * Forma una fecha con format User, aunque sea incorrecta * Usada solo para los tests, y comprobar que el error se detecta */ static function fechaUser($d,$m,$a) { $p = ConfigFramework::getDateMaskUser(); $partes = array(); $partes[0] = self::selecParte($p[0],$d,$m,$a); $partes[1] = $p[1]; $partes[2] = self::selecParte($p[2],$d,$m,$a); $partes[3] = $p[3]; $partes[4] = self::selecParte($p[4],$d,$m,$a); return implode($partes); } static private function selecParte($car,$d,$m,$a) { switch ($car) { case 'd': case 'j': return $d; case 'm': case 'n': return $m; case 'Y': return $a; default: throw new gvHidraException('Caracter incorrecto: '.$car); } } /** * tipo puede ser TIPO_FECHA o TIPO_FECHAHORA */ static private function fechaFW2User($fecha,$tipo) { return IgepComunicaUsuario::prepararPresentacion($fecha,$tipo); } public function testTransform_User2FW01() { $p = ConfigFramework::getNumericSeparatorsUser(); $pd = $p['DECIMAL']; $pg = $p['GROUP']; $n = ConfigFramework::getNumericSeparatorsFW(); $nd = $n['DECIMAL']; $ng = $n['GROUP']; $nf = ConfigFramework::getDateMaskFW(); $pf = ConfigFramework::getDateMaskUser(); // numeros $v = "1{$pg}234"; IgepComunicacion::transform_User2FW($v,TIPO_DECIMAL); $this->assertSame("1{$ng}234",$v, "decimal con grupos"); $v = "1{$pg}234{$pg}567"; $res2 = IgepComunicacion::transform_User2FW($v,TIPO_ENTERO); $this->assertSame("1{$ng}234{$ng}567", $v, "entero con grupos"); $v = 'numeroinvalido'; IgepComunicacion::transform_User2FW($v, TIPO_ENTERO); $this->assertSame('0', $v); $errores = ConfigFramework::getTransformErrors(); $this->assertSame(1, count($errores), 'no defecta numero invalido - '.var_export($errores,true)); //TODO: el tipo entero no se maneja muy bien en el transformer y se produce // algun mensaje de error confuso $v = "{$pd}39{$pg}343"; IgepComunicacion::transform_User2FW($v, TIPO_ENTERO); $this->assertSame("0{$nd}393430", $v); $errores = ConfigFramework::getTransformErrors(); $this->assertSame(0, count($errores), 'defecta entero incorrecto - '.var_export($errores,true)); // traidos de ConfIgep::transformaNumero $res = '1234'; $v = "1{$pg}234"; IgepComunicacion::transform_User2FW($v, TIPO_ENTERO); $this->assertTrue($v==$res, "resultado '$v', debe dar '$res'"); $res = '1234567'; $v = "1{$pg}234{$pg}567"; IgepComunicacion::transform_User2FW($v, TIPO_ENTERO); $this->assertTrue($v==$res, "resultado '$v', debe dar '$res'"); $res = 1234.567; $v = "1{$pg}234{$pd}567"; IgepComunicacion::transform_User2FW($v, TIPO_DECIMAL); $this->assertTrue($v==$res, "resultado '$v', debe dar '$res'"); $res = 0.567; $v = "0{$pd}567"; IgepComunicacion::transform_User2FW($v, TIPO_DECIMAL); $this->assertTrue($v==$res, "resultado '$v', debe dar '$res'"); // numeros con signo $res = '-1234'; $v = "-1{$pg}234"; IgepComunicacion::transform_User2FW($v, TIPO_ENTERO); $this->assertEquals($v,$res, "resultado '$v', debe dar '$res'"); $res = '-1234.56'; $v = "-1{$pg}234{$pd}56"; IgepComunicacion::transform_User2FW($v, TIPO_DECIMAL); $this->assertEquals($v,$res, "resultado '$v', debe dar '$res'"); $res = '1234.56'; $v = "+1{$pg}234{$pd}56"; IgepComunicacion::transform_User2FW($v, TIPO_DECIMAL); $this->assertEquals($v,$res, "resultado '$v', debe dar '$res'"); // // fechas $v = 'fecha invalida'; IgepComunicacion::transform_User2FW($v, TIPO_FECHA); $errores = ConfigFramework::getTransformErrors(); $this->assertSame($v,null); $this->assertEquals(1, count($errores), 'no defecta fecha invalida - '.var_export($errores,true)); $v = 'fechainvalida'; IgepComunicacion::transform_User2FW($v, TIPO_FECHA); $this->assertSame($v,null); $errores = ConfigFramework::getTransformErrors(); $this->assertSame(1, count($errores), 'no defecta fecha invalida (1 palabra) - '.var_export($errores,true)); $v = self::fechaUser('30','02','1995'); IgepComunicacion::transform_User2FW($v, TIPO_FECHA); $errores = ConfigFramework::getTransformErrors(); $this->assertSame(1, count($errores), 'no defecta dia invalido - '.var_export($errores,true)); $v = ''; IgepComunicacion::transform_User2FW($v, TIPO_FECHA); $this->assertTrue(is_null($v)); $v = null; IgepComunicacion::transform_User2FW($v, TIPO_FECHA); $this->assertTrue(is_null($v)); $var_unset = ''; unset($var_unset); IgepComunicacion::transform_User2FW($var_unset, TIPO_FECHA); $this->assertTrue(is_null($var_unset)); $fnegocio = new gvHidraTimestamp('1995-12-24'); $factualpantalla = self::fechaFW2User($fnegocio,TIPO_FECHA); IgepComunicacion::transform_User2FW($factualpantalla, TIPO_FECHA); $this->assertSame($fnegocio->formatSOAP(),$factualpantalla->formatSOAP(), "obj1-fecha simple"); $fnegocio = new gvHidraTimestamp('1995-12-24 15:24:56'); $factualpantalla = self::fechaFW2User($fnegocio,TIPO_FECHAHORA); IgepComunicacion::transform_User2FW($factualpantalla, TIPO_FECHAHORA); $this->assertSame($fnegocio->formatSOAP(), $factualpantalla->formatSOAP(), "obj2-fecha con hora"); $v = '34'; IgepComunicacion::transform_User2FW($v, TIPO_FECHAHORA); $errores = ConfigFramework::getTransformErrors(); $this->assertNull($v, "numero"); $this->assertSame(1, count($errores), 'no defecta fecha invalida - '.var_export($errores,true)); $v = '-34'; IgepComunicacion::transform_User2FW($v, TIPO_FECHAHORA); $errores = ConfigFramework::getTransformErrors(); $this->assertNull($v, "numero negativo"); $this->assertSame(1, count($errores), 'no defecta fecha invalida - '.var_export($errores,true)); $v = '34.2'; IgepComunicacion::transform_User2FW($v, TIPO_FECHAHORA); $errores = ConfigFramework::getTransformErrors(); $this->assertNull($v, "numero decimal"); $this->assertSame(1, count($errores), 'no defecta fecha invalida - '.var_export($errores,true)); $v = self::fechaUser('12','11',''); IgepComunicacion::transform_User2FW($v, TIPO_FECHAHORA); $errores = ConfigFramework::getTransformErrors(); $this->assertNull($v, "fecha incompleta"); $this->assertSame(1, count($errores), 'no defecta fecha invalida - '.var_export($errores,true)); $v = self::fechaUser('12','11','2007').' 18'; IgepComunicacion::transform_User2FW($v, TIPO_FECHAHORA); $errores = ConfigFramework::getTransformErrors(); $this->assertNull($v, "fecha con hora incompleta"); $this->assertSame(1, count($errores), 'no defecta fecha invalida - '.var_export($errores,true)); $v = self::fechaUser('12','11','2007').' 18:163'; IgepComunicacion::transform_User2FW($v, TIPO_FECHAHORA); $errores = ConfigFramework::getTransformErrors(); $this->assertNull($v, "fecha con minuto erroneo"); $this->assertSame(1, count($errores), 'no defecta fecha invalida - '.var_export($errores,true)); $v1 = self::fechaUser('4','12','2007'); IgepComunicacion::transform_User2FW($v1, TIPO_FECHAHORA); $v2 = self::fechaUser('04','12','2007'); IgepComunicacion::transform_User2FW($v2, TIPO_FECHAHORA); $this->assertEquals($v1->formatSOAP(), $v2->formatSOAP(), "no convierte dia sin 0's delante"); $v1 = self::fechaUser('04','2','2007'); IgepComunicacion::transform_User2FW($v1, TIPO_FECHAHORA); $v2 = self::fechaUser('04','02','2007'); IgepComunicacion::transform_User2FW($v2, TIPO_FECHAHORA); $this->assertEquals($v1->formatSOAP(), $v2->formatSOAP(), "no convierte mes sin 0's delante"); // otros tests $v = 'algo'; IgepComunicacion::transform_User2FW($v, null); $this->assertSame('algo', $v,'tipo null'); IgepComunicacion::transform_User2FW($v,''); $this->assertSame('algo', $v,'tipo cadena vacia'); IgepComunicacion::transform_User2FW($v); $this->assertSame('algo', $v,'sin tipo'); } public function testTransform_User2FW02() { $v = "algo"; try { IgepComunicacion::transform_User2FW($v,array('')); } catch (Exception $e) { return; } $this->fail('tipo array vacia'); } } ?>