o = new IgepComunicaUsuario($var,$var,$var); } /** * 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 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 testSetIndex(). */ public function testSetIndex() { // 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 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 testGetValue(). */ public function testGetValue() { // 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 testSetSelected(). */ public function testSetSelected() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetSeleccionado(). */ public function testSetSeleccionado() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetValue(). */ public function testSetValue() { // 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 testFetchTupla(). */ public function testFetchTupla() { // 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 testIsEmpty(). */ public function testIsEmpty() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetList(). */ public function testGetList() { // 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 testGetFileInfo(). */ public function testGetFileInfo() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetRowColor(). */ public function testSetRowColor() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test_prepararOperacion(). */ public function test_prepararOperacion() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * de negocio a interfaz */ public function testPrepararPresentacion() { $fhora = ' H:i:s'; // los tests de fechas basados en los de ConfIgepTest::testFormatoFecha $cambios = array( // array('j','d'), //array('n','m'), ); $pe = ConfigFramework::getDateMaskUser(); $n = ConfigFramework::getDateMaskFW(); // obtengo formato salida $po = $pe; foreach ($cambios as $fila=>$val) { $po = str_replace($val[0], $val[1], $po); } $pant = ConfigFramework::getNumericSeparatorsUser(); $d = $pant['DECIMAL']; $g = $pant['GROUP']; $neg = ConfigFramework::getNumericSeparatorsFW(); $nd = $neg['DECIMAL']; $ng = $neg['GROUP']; // fecha en negocio como objeto $fnegocio = new gvHidraTimestamp('1995-12-24'); $factualpantalla = $fnegocio; $this->o->prepararPresentacion($factualpantalla,TIPO_FECHA); $this->assertSame($factualpantalla, $fnegocio->formatUser(), "obj1-fecha simple"); $fnegocio = new gvHidraTimestamp('1995-12-24 15:24:56'); $factualpantalla = $fnegocio; $this->o->prepararPresentacion($factualpantalla,TIPO_FECHAHORA); $this->assertSame($factualpantalla, $fnegocio->formatUser(), "obj2-fecha con hora"); $fnegocio = new gvHidraTimestamp('1995-06-04'); // 4-jun $factualpantalla = $fnegocio; $this->o->prepararPresentacion($factualpantalla,TIPO_FECHA); $this->assertSame($factualpantalla, $fnegocio->formatUser(), "obj3-dia y mes menor de 10"); // fecha en negocio como string $f = new gvHidraTimestamp('1995-12-24'); $fnegocio = $f->formatFW(); $factualpantalla = $fnegocio; $this->o->prepararPresentacion($factualpantalla,TIPO_FECHA); $this->assertSame($factualpantalla, $f->formatUser(), "st1-fecha simple"); $f = new gvHidraTimestamp('1995-12-24 15:24:56'); $fnegocio = $f->formatFW(); $this->o->prepararPresentacion($fnegocio,TIPO_FECHAHORA); $this->assertSame($fnegocio, $f->formatUser(), "st2-fecha con hora"); $f = new gvHidraTimestamp('1995-06-04'); // 4-jun $fnegocio = $f->formatFW(); $this->o->prepararPresentacion($fnegocio,TIPO_FECHA); $this->assertSame($fnegocio, $f->formatUser(), "st3-dia y mes menor de 10"); // los tests de numeros basados en los de ConfIgepTest::testFormatoNumero $num = 123; $this->o->prepararPresentacion($num,TIPO_ENTERO); $this->assertEquals($num,123,'entero como numero, sin grupos ni decimales'); $num = '123'; $this->o->prepararPresentacion($num,TIPO_ENTERO); $this->assertEquals($num,123,'entero como string, sin grupos ni decimales'); $res = "1{$g}234"; $num = 1234; $this->o->prepararPresentacion($num,TIPO_ENTERO); $this->assertSame($res,$num, 'entero como numero entero, con 1 grupo'); $res = "1{$g}234{$d}00"; $num = 1234; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame($res,$num, 'entero como numero decimal, con 1 grupo'); $res = "1{$g}234{$d}57"; $num = 1234.57; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame($num,$res, 'decimal con grupo'); $res = "1{$g}234{$d}567"; $num = 1234.567; $this->o->prepararPresentacion($num,TIPO_DECIMAL, 3); $this->assertSame($num,$res, 'decimal con 3 decimales'); $res = "0{$d}567"; $num = .567; $this->o->prepararPresentacion($num,TIPO_DECIMAL, 3); $this->assertSame($num,$res, 'decimal sin parte entera'); $res = "1{$g}567"; $num = 1567; $this->o->prepararPresentacion($num,TIPO_DECIMAL, 0); $this->assertSame($num,$res, 'decimal con 0 decimales'); $res = "1{$g}000"; $num = 1E3; $this->o->prepararPresentacion($num,TIPO_DECIMAL, 0); $this->assertSame($num,$res, 'entero con exponente'); // numeros con signo $res = "-1{$g}234{$d}00"; $num = -1234; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame($num,$res, 'numero negativo con un grupo'); $res = "-1{$g}234{$d}56"; $num = -1234.56; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame($num,$res, 'numero negativo con un grupo y 2 decimales'); $res = "-1{$g}234{$d}000"; $num = -1234.0; $this->o->prepararPresentacion($num,TIPO_DECIMAL,3); $this->assertSame($num,$res, 'numero negativo con un grupo y 3 decimales'); $res = "1{$g}234{$d}00"; $num = +1234; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame($num,$res, 'numero positivo con un grupo y sin decimales'); $num = 0; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame("0{$d}00", $num, 'numero 0 y sin decimales'); $num = 0.0; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame("0{$d}00", $num, 'numero 0 como double y sin decimales'); $num = "0"; $this->o->prepararPresentacion($num,TIPO_DECIMAL); $this->assertSame("0{$d}00", $num, 'numero 0 como string y sin decimales'); $num = 0; $this->o->prepararPresentacion($num,TIPO_ENTERO); $this->assertSame("0", $num, 'numero 0 entero y sin decimales'); $num = 0.0; $this->o->prepararPresentacion($num,TIPO_ENTERO); $this->assertSame("0", $num, 'numero 0 como double y sin decimales'); $res = "abc"; $num = $res; $this->o->prepararPresentacion($num,TIPO_CARACTER); $this->assertSame($num,$res, 'cadena sin comillas'); $res = "ab'c"; $num = $res; $this->o->prepararPresentacion($num,TIPO_CARACTER); $this->assertSame($num,$res, 'cadena con comillas'); $res = ""; $num = $res; $this->o->prepararPresentacion($num,TIPO_CARACTER); $this->assertSame($num,$res, 'cadena vacia'); // arrays: prueba de algunos casos $datos = array( array('edad'=>"1e5", 'importe'=>"1{$ng}234{$ng}567{$nd}8", 'nom'=>"abc", 'saldo'=>"-12", 'ffirma'=>new gvHidraTimestamp('1995-12-24'), 'nombre'=>"abc", ), array('edad'=>"-1{$ng}234{$ng}567", 'importe'=>"1{$ng}234{$ng}567{$nd}89", 'nom'=>"a'bc", 'saldo'=>"+12", 'ffirma'=>"se asigna abajo!!!", 'nombre'=>"a'bc", ), array('edad'=>"+1{$ng}234{$ng}567", 'importe'=>"0", 'nom'=>"", 'saldo'=>"", 'ffirma'=>new gvHidraTimestamp('1995-06-04'), 'factu'=>new gvHidraTimestamp('1995-12-24 18:34:56'), 'nombre'=>'a"bc', ), array('edad'=>"", 'importe'=>0, 'nom'=>"", 'saldo'=>"", 'ffirma'=>'se asigna abajo!!!', 'factu'=>"se asigna abajo!!!", 'nombre'=>"a\\bc", ), ); $datos[1]['ffirma'] = $datos[0]['ffirma']->formatFW(); $datos[3]['factu'] = $datos[2]['factu']->formatFW(); $datos[3]['ffirma'] = $datos[2]['ffirma']->formatFW(); $tipos = array('edad'=>array('tipo'=>TIPO_ENTERO), 'importe'=>array('tipo'=>TIPO_DECIMAL, 'parteDecimal'=>2), 'saldo'=>array('tipo'=>TIPO_ENTERO), 'ffirma'=>array('tipo'=>TIPO_FECHA), 'factu'=>array('tipo'=>TIPO_FECHAHORA), 'nombre'=>array('tipo'=>TIPO_CARACTER), ); $valor = $datos; $this->o->prepararPresentacion($valor,$tipos); // cadenas $this->assertSame($valor[0]['nom'],'abc', 'cadena sin definir sin comillas (array)'); $this->assertSame($valor[1]['nom'],"a'bc", 'cadena sin cefinir con comillas (array)'); $this->assertSame($valor[0]['nombre'],'abc', 'cadena sin comillas (array)'); $this->assertSame($valor[1]['nombre'],"a'bc", 'cadena con comillas (array)'); $this->assertSame($valor[3]['nom'],"", 'cadena vacia (array)'); // numeros $this->assertSame($valor[0]['importe'],"1{$g}234{$g}567{$d}80", 'numero con grupos y decimales (array)'); $this->assertSame($valor[0]['saldo'],"-12", 'numero entero negativo (array)'); $this->assertSame($valor[0]['edad'],"100{$g}000", 'numero con grupos, exp y sin decimales (array)'); // fechas // fecha en negocio como obj $this->assertSame($valor[0]['ffirma'], $datos[0]['ffirma']->formatUser(), "obj1-fecha sin hora (array)"); $this->assertSame($valor[2]['factu'], $datos[2]['factu']->formatUser(), "obj2-fecha con hora (array)"); $this->assertSame($valor[2]['ffirma'], $datos[2]['ffirma']->formatUser(), "obj3-fecha sin hora con dia y mes menor de 10 (array)"); // fecha en negocio como string $this->assertSame($valor[1]['ffirma'], $datos[0]['ffirma']->formatUser(), "st1-fecha sin hora en string (array)"); $this->assertSame($valor[3]['factu'], $datos[2]['factu']->formatUser(), "st2-fecha con hora en string (array)"); $this->assertSame($valor[3]['ffirma'], $datos[2]['ffirma']->formatUser(), "st3-fecha sin hora con dia y mes menor de 10 (array)"); } /** * @todo Implement testGetForward(). */ public function testGetForward() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?>