Passed
Push — main ( ef0a91...c8f39c )
by Osvaldo
01:07
created
src/pdodatabase/elementos/WhereBetween.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
 
21 21
     public function datos(): array
22 22
     {
23
-        return [ $this->_where[1], $this->_where[2] ];
23
+        return [$this->_where[1], $this->_where[2]];
24 24
     }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
 
7 7
 class WhereBetween implements WhereInterface
8 8
 {
9
-    private $_where;
9
+	private $_where;
10 10
     
11
-    public function __construct(ValidadorDeParametrosInterface $ValidadorDeParametrosInterface)
12
-    {
13
-        $this->_where = $ValidadorDeParametrosInterface->datos();
14
-    }
11
+	public function __construct(ValidadorDeParametrosInterface $ValidadorDeParametrosInterface)
12
+	{
13
+		$this->_where = $ValidadorDeParametrosInterface->datos();
14
+	}
15 15
 
16
-    public function sql(): string
17
-    {
18
-        return 'WHERE BETWEEN '.$this->_where[0].' ? AND ?';
19
-    }
16
+	public function sql(): string
17
+	{
18
+		return 'WHERE BETWEEN '.$this->_where[0].' ? AND ?';
19
+	}
20 20
 
21
-    public function datos(): array
22
-    {
23
-        return [ $this->_where[1], $this->_where[2] ];
24
-    }
21
+	public function datos(): array
22
+	{
23
+		return [ $this->_where[1], $this->_where[2] ];
24
+	}
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/pdodatabase/elementos/WhereOr.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
 
21 21
     public function datos(): array
22 22
     {
23
-        return [ $this->_where[2], $this->_where[5] ];
23
+        return [$this->_where[2], $this->_where[5]];
24 24
     }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
 
7 7
 class WhereOr implements WhereInterface
8 8
 {
9
-    private $_where;
9
+	private $_where;
10 10
     
11
-    public function __construct(ValidadorDeParametrosInterface $ValidadorDeParametrosInterface)
12
-    {
13
-        $this->_where = $ValidadorDeParametrosInterface->datos();
14
-    }
11
+	public function __construct(ValidadorDeParametrosInterface $ValidadorDeParametrosInterface)
12
+	{
13
+		$this->_where = $ValidadorDeParametrosInterface->datos();
14
+	}
15 15
 
16
-    public function sql(): string
17
-    {
18
-        return 'WHERE '.$this->_where[0].' '.$this->_where[1].' ? OR '.$this->_where[3].' '.$this->_where[4].' ?';
19
-    }
16
+	public function sql(): string
17
+	{
18
+		return 'WHERE '.$this->_where[0].' '.$this->_where[1].' ? OR '.$this->_where[3].' '.$this->_where[4].' ?';
19
+	}
20 20
 
21
-    public function datos(): array
22
-    {
23
-        return [ $this->_where[2], $this->_where[5] ];
24
-    }
21
+	public function datos(): array
22
+	{
23
+		return [ $this->_where[2], $this->_where[5] ];
24
+	}
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/pdodatabase/ejecutar/EjecutarConsultaConDatos.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
     {
20 20
         $query = $this->_conexion->prepare($sentencia->sql());
21 21
 
22
-        $x=1;
22
+        $x = 1;
23 23
         foreach ($sentencia->datos() as $value)
24 24
         {
25
-            $query->bindValue($x,$value);
25
+            $query->bindValue($x, $value);
26 26
             $x++;	
27 27
         }
28 28
         
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         {
31 31
             $query->execute();
32 32
         }
33
-        catch(PDOException $e)
33
+        catch (PDOException $e)
34 34
         {
35 35
             throw new Exception("Error en la consulta");
36 36
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
         try
30 30
         {
31 31
             $query->execute();
32
-        }
33
-        catch(PDOException $e)
32
+        } catch(PDOException $e)
34 33
         {
35 34
             throw new Exception("Error en la consulta");
36 35
         }
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -8,33 +8,33 @@
 block discarded – undo
8 8
 
9 9
 class EjecutarConsultaConDatos
10 10
 {
11
-    private $_conexion;
11
+	private $_conexion;
12 12
 
13
-    public function __construct(ConexionBaseDeDatos $conexionBaseDeDatos)
14
-    {
15
-        $this->_conexion = $conexionBaseDeDatos->conectar();
16
-    }
13
+	public function __construct(ConexionBaseDeDatos $conexionBaseDeDatos)
14
+	{
15
+		$this->_conexion = $conexionBaseDeDatos->conectar();
16
+	}
17 17
 
18
-    public function query(object $sentencia): PDOStatement
19
-    {
20
-        $query = $this->_conexion->prepare($sentencia->sql());
18
+	public function query(object $sentencia): PDOStatement
19
+	{
20
+		$query = $this->_conexion->prepare($sentencia->sql());
21 21
 
22
-        $x=1;
23
-        foreach ($sentencia->datos() as $value)
24
-        {
25
-            $query->bindValue($x,$value);
26
-            $x++;	
27
-        }
22
+		$x=1;
23
+		foreach ($sentencia->datos() as $value)
24
+		{
25
+			$query->bindValue($x,$value);
26
+			$x++;	
27
+		}
28 28
         
29
-        try
30
-        {
31
-            $query->execute();
32
-        }
33
-        catch(PDOException $e)
34
-        {
35
-            throw new Exception("Error en la consulta");
36
-        }
29
+		try
30
+		{
31
+			$query->execute();
32
+		}
33
+		catch(PDOException $e)
34
+		{
35
+			throw new Exception("Error en la consulta");
36
+		}
37 37
 
38
-        return $query;
39
-    }
38
+		return $query;
39
+	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
src/pdodatabase/ejecutar/EjecutarConsultaSinDatos.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         {
24 24
             $query->execute();
25 25
         }
26
-        catch(PDOException $e)
26
+        catch (PDOException $e)
27 27
         {
28 28
             throw new Exception("Error en la consulta");
29 29
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
         try
30 30
         {
31 31
             $query->execute();
32
-        }
33
-        catch(PDOException $e)
32
+        } catch(PDOException $e)
34 33
         {
35 34
             throw new Exception("Error en la consulta");
36 35
         }
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,27 +8,27 @@
 block discarded – undo
8 8
 
9 9
 class EjecutarConsultaSinDatos 
10 10
 {
11
-    private $_conexion;
11
+	private $_conexion;
12 12
 
13
-    public function __construct(ConexionBaseDeDatos $conexionBaseDeDatos)
14
-    {
15
-        $this->_conexion = $conexionBaseDeDatos->conectar();
16
-    }
13
+	public function __construct(ConexionBaseDeDatos $conexionBaseDeDatos)
14
+	{
15
+		$this->_conexion = $conexionBaseDeDatos->conectar();
16
+	}
17 17
 
18
-    public function query(string $sql): PDOStatement
19
-    {
20
-        $query = $this->_conexion->prepare($sql);
18
+	public function query(string $sql): PDOStatement
19
+	{
20
+		$query = $this->_conexion->prepare($sql);
21 21
         
22
-        try
23
-        {
24
-            $query->execute();
25
-        }
26
-        catch(PDOException $e)
27
-        {
28
-            throw new Exception("Error en la consulta");
29
-        }
22
+		try
23
+		{
24
+			$query->execute();
25
+		}
26
+		catch(PDOException $e)
27
+		{
28
+			throw new Exception("Error en la consulta");
29
+		}
30 30
         
31 31
 
32
-        return $query;
33
-    }
32
+		return $query;
33
+	}
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
test/ElementosTest.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     public function testCamposSoloRetornaTexto()
48 48
     {
49
-        $campos = new Campos(['*','78']);
49
+        $campos = new Campos(['*', '78']);
50 50
         $this->assertIsString($campos->sql());
51 51
     }
52 52
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
         $tabla = new Tabla('prueba');
58 58
         $campos = new Campos(['a,b,c,d']);
59 59
 
60
-        $camposytabla = new CamposYTabla($campos,$tabla);
60
+        $camposytabla = new CamposYTabla($campos, $tabla);
61 61
 
62
-        $this->assertSame('a,b,c,d FROM prueba',$camposytabla->sql());
62
+        $this->assertSame('a,b,c,d FROM prueba', $camposytabla->sql());
63 63
     }
64 64
 
65 65
     //Clase ValidadorDeParametrosWhere
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
     public function testValidadorDeParametrosWhereLaColumnaSoloPuedeSerString()
74 74
     {
75 75
         $this->expectException(Exception::class);
76
-        new ValidadorDeParametrosWhere([1,'1','2']);
76
+        new ValidadorDeParametrosWhere([1, '1', '2']);
77 77
     }
78 78
 
79 79
     public function testValidadorDeParametrosWhereNingunCampoPuedeEstarVacio()
80 80
     {
81 81
         $this->expectException(Exception::class);
82
-        new ValidadorDeParametrosWhere(['','1','2']);
82
+        new ValidadorDeParametrosWhere(['', '1', '2']);
83 83
     }
84 84
 
85 85
     //Clase ValidadorDeParametrosWhereBetween
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
     public function testValidadorDeParametrosWhereBetweenNoPuedeTenerValoresIguales()
94 94
     {
95 95
         $this->expectException(Exception::class);
96
-        new ValidadorDeParametrosWhereBetween(['id','1','1']);
96
+        new ValidadorDeParametrosWhereBetween(['id', '1', '1']);
97 97
     }
98 98
 
99 99
     public function testValidadorDeParametrosWhereBetweenLaColumnaSoloPuedeSerString()
100 100
     {
101 101
         $this->expectException(Exception::class);
102
-        new ValidadorDeParametrosWhereBetween([1,'1','2']);
102
+        new ValidadorDeParametrosWhereBetween([1, '1', '2']);
103 103
     }
104 104
 
105 105
     public function testValidadorDeParametrosWhereBetweenNingunCampoPuedeEstarVacio()
106 106
     {
107 107
         $this->expectException(Exception::class);
108
-        new ValidadorDeParametrosWhereBetween(['','1','2']);
108
+        new ValidadorDeParametrosWhereBetween(['', '1', '2']);
109 109
     }
110 110
 
111 111
     //Clase Where
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $where = new Where(
116 116
             new ValidadorDeParametrosWhere(
117
-                ['id','=','21']
117
+                ['id', '=', '21']
118 118
             )
119 119
             );
120 120
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $where = new Where(
127 127
             new ValidadorDeParametrosWhere(
128
-                ['id','=','21']
128
+                ['id', '=', '21']
129 129
             )
130 130
             );
131 131
 
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
     public function testValidadorDeParametrosWhereAndOthersLaColumnaSoloPuedeSerString()
144 144
     {
145 145
         $this->expectException(Exception::class);
146
-        new ValidadorDeParametrosWhereAndOthers([1,'=','2','1','=','2']);
146
+        new ValidadorDeParametrosWhereAndOthers([1, '=', '2', '1', '=', '2']);
147 147
     }
148 148
 
149 149
     public function testValidadorDeParametrosWhereAndOthersNingunCampoPuedeEstarVacio()
150 150
     {
151 151
         $this->expectException(Exception::class);
152
-        new ValidadorDeParametrosWhereAndOthers(['','1','2','','','']);
152
+        new ValidadorDeParametrosWhereAndOthers(['', '1', '2', '', '', '']);
153 153
     }
154 154
 
155 155
     //Clase Where And
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     {
159 159
         $where = new WhereAnd(
160 160
             new ValidadorDeParametrosWhereAndOthers(
161
-                ['id','=','21','uno','=','1']
161
+                ['id', '=', '21', 'uno', '=', '1']
162 162
             )
163 163
             );
164 164
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $where = new WhereOr(
173 173
             new ValidadorDeParametrosWhereAndOthers(
174
-                ['id','=','21','uno','=','1']
174
+                ['id', '=', '21', 'uno', '=', '1']
175 175
             )
176 176
             );
177 177
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     {
185 185
         $where = new WhereBetween(
186 186
             new ValidadorDeParametrosWhereBetween(
187
-                ['id','1','21']
187
+                ['id', '1', '21']
188 188
             )
189 189
             );
190 190
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     {
198 198
         $where = new WhereNotBetween(
199 199
             new ValidadorDeParametrosWhereBetween(
200
-                ['id','1','21']
200
+                ['id', '1', '21']
201 201
             )
202 202
             );
203 203
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $where = new WhereNotBetween(
212 212
             new ValidadorDeParametrosWhereBetween(
213
-                ['id','1','21']
213
+                ['id', '1', '21']
214 214
             )
215 215
             );
216 216
         
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $where = new WhereNotBetween(
229 229
             new ValidadorDeParametrosWhereBetween(
230
-                ['id','1','21']
230
+                ['id', '1', '21']
231 231
             )
232 232
             );
233 233
         
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             new CamposYTabla(
240 240
                 new Campos(['*']),
241 241
                 new Tabla('prueba')
242
-            ),$como
242
+            ), $como
243 243
         );
244 244
 
245 245
         $this->assertSame('SELECT * FROM prueba WHERE NOT BETWEEN id ? AND ?', $sentencia->sql());
Please login to merge, or discard this patch.
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -22,240 +22,240 @@
 block discarded – undo
22 22
 
23 23
 class ElementosTest extends TestCase
24 24
 {
25
-    //Clase Tabla
26
-
27
-    public function testSiLaTablaEstaVaciaLanzaExcepcion()
28
-    {
29
-        $this->expectException(Exception::class);
30
-        $tabla = new Tabla('');
31
-    }
32
-
33
-    public function testTablaSoloRetornaTexto()
34
-    {
35
-        $tabla = new Tabla('Hola');
36
-        $this->assertIsString($tabla->sql());
37
-    }
38
-
39
-    //Clase Campos
40
-
41
-    public function testSiElCampoEstaVacioLanzaExcepcion()
42
-    {
43
-        $this->expectException(Exception::class);
44
-        $campos = new Campos([]);
45
-    }
46
-
47
-    public function testCamposSoloRetornaTexto()
48
-    {
49
-        $campos = new Campos(['*','78']);
50
-        $this->assertIsString($campos->sql());
51
-    }
52
-
53
-    //Clase CamposyTabla
54
-
55
-    public function testCamposYTablaDevuelveValorCorrecto()
56
-    {
57
-        $tabla = new Tabla('prueba');
58
-        $campos = new Campos(['a,b,c,d']);
59
-
60
-        $camposytabla = new CamposYTabla($campos,$tabla);
61
-
62
-        $this->assertSame('a,b,c,d FROM prueba',$camposytabla->sql());
63
-    }
64
-
65
-    //Clase ValidadorDeParametrosWhere
66
-
67
-    public function testValidadorDeParametrosWhereElArrayNoPuedeEstarVacio()
68
-    {
69
-        $this->expectException(Exception::class);
70
-        new ValidadorDeParametrosWhere([]);
71
-    }
72
-
73
-    public function testValidadorDeParametrosWhereLaColumnaSoloPuedeSerString()
74
-    {
75
-        $this->expectException(Exception::class);
76
-        new ValidadorDeParametrosWhere([1,'1','2']);
77
-    }
78
-
79
-    public function testValidadorDeParametrosWhereNingunCampoPuedeEstarVacio()
80
-    {
81
-        $this->expectException(Exception::class);
82
-        new ValidadorDeParametrosWhere(['','1','2']);
83
-    }
84
-
85
-    //Clase ValidadorDeParametrosWhereBetween
86
-
87
-    public function testValidadorDeParametrosWhereBetweenElArrayNoPuedeEstarVacio()
88
-    {
89
-        $this->expectException(Exception::class);
90
-        new ValidadorDeParametrosWhereBetween([]);
91
-    }
92
-
93
-    public function testValidadorDeParametrosWhereBetweenNoPuedeTenerValoresIguales()
94
-    {
95
-        $this->expectException(Exception::class);
96
-        new ValidadorDeParametrosWhereBetween(['id','1','1']);
97
-    }
98
-
99
-    public function testValidadorDeParametrosWhereBetweenLaColumnaSoloPuedeSerString()
100
-    {
101
-        $this->expectException(Exception::class);
102
-        new ValidadorDeParametrosWhereBetween([1,'1','2']);
103
-    }
104
-
105
-    public function testValidadorDeParametrosWhereBetweenNingunCampoPuedeEstarVacio()
106
-    {
107
-        $this->expectException(Exception::class);
108
-        new ValidadorDeParametrosWhereBetween(['','1','2']);
109
-    }
110
-
111
-    //Clase Where
112
-
113
-    public function testWhereArrojaStringValido()
114
-    {
115
-        $where = new Where(
116
-            new ValidadorDeParametrosWhere(
117
-                ['id','=','21']
118
-            )
119
-            );
120
-
121
-        $this->assertSame('WHERE id = ?', $where->sql());
122
-    }
123
-
124
-    public function testWhereArrojaArrayEnMetodoDatos()
125
-    {
126
-        $where = new Where(
127
-            new ValidadorDeParametrosWhere(
128
-                ['id','=','21']
129
-            )
130
-            );
131
-
132
-        $this->assertIsArray($where->datos());
133
-    }
134
-
135
-    //Clase ValidadorDeParametrosWhereAndOthers
136
-
137
-    public function testValidadorDeParametrosWhereAndOthersElArrayNoPuedeEstarVacio()
138
-    {
139
-        $this->expectException(Exception::class);
140
-        new ValidadorDeParametrosWhereAndOthers([]);
141
-    }
142
-
143
-    public function testValidadorDeParametrosWhereAndOthersLaColumnaSoloPuedeSerString()
144
-    {
145
-        $this->expectException(Exception::class);
146
-        new ValidadorDeParametrosWhereAndOthers([1,'=','2','1','=','2']);
147
-    }
148
-
149
-    public function testValidadorDeParametrosWhereAndOthersNingunCampoPuedeEstarVacio()
150
-    {
151
-        $this->expectException(Exception::class);
152
-        new ValidadorDeParametrosWhereAndOthers(['','1','2','','','']);
153
-    }
154
-
155
-    //Clase Where And
156
-
157
-    public function testWhereAndArrojaStringValido()
158
-    {
159
-        $where = new WhereAnd(
160
-            new ValidadorDeParametrosWhereAndOthers(
161
-                ['id','=','21','uno','=','1']
162
-            )
163
-            );
164
-
165
-        $this->assertSame('WHERE id = ? AND uno = ?', $where->sql());
166
-    }
167
-
168
-    //Clase Where Or
169
-
170
-    public function testWhereOrArrojaStringValido()
171
-    {
172
-        $where = new WhereOr(
173
-            new ValidadorDeParametrosWhereAndOthers(
174
-                ['id','=','21','uno','=','1']
175
-            )
176
-            );
177
-
178
-        $this->assertSame('WHERE id = ? OR uno = ?', $where->sql());
179
-    }
180
-
181
-    //Clase Where Between
182
-
183
-    public function testWhereBetweenArrojaStringValido()
184
-    {
185
-        $where = new WhereBetween(
186
-            new ValidadorDeParametrosWhereBetween(
187
-                ['id','1','21']
188
-            )
189
-            );
190
-
191
-        $this->assertSame('WHERE BETWEEN id ? AND ?', $where->sql());
192
-    }
193
-
194
-    //Clase Where Not Between
195
-
196
-    public function testWhereNotBetweenArrojaStringValido()
197
-    {
198
-        $where = new WhereNotBetween(
199
-            new ValidadorDeParametrosWhereBetween(
200
-                ['id','1','21']
201
-            )
202
-            );
203
-
204
-        $this->assertSame('WHERE NOT BETWEEN id ? AND ?', $where->sql());
205
-    }
206
-
207
-    //Clase Como 
208
-
209
-    public function testComoArrojaStringValido()
210
-    {
211
-        $where = new WhereNotBetween(
212
-            new ValidadorDeParametrosWhereBetween(
213
-                ['id','1','21']
214
-            )
215
-            );
25
+	//Clase Tabla
26
+
27
+	public function testSiLaTablaEstaVaciaLanzaExcepcion()
28
+	{
29
+		$this->expectException(Exception::class);
30
+		$tabla = new Tabla('');
31
+	}
32
+
33
+	public function testTablaSoloRetornaTexto()
34
+	{
35
+		$tabla = new Tabla('Hola');
36
+		$this->assertIsString($tabla->sql());
37
+	}
38
+
39
+	//Clase Campos
40
+
41
+	public function testSiElCampoEstaVacioLanzaExcepcion()
42
+	{
43
+		$this->expectException(Exception::class);
44
+		$campos = new Campos([]);
45
+	}
46
+
47
+	public function testCamposSoloRetornaTexto()
48
+	{
49
+		$campos = new Campos(['*','78']);
50
+		$this->assertIsString($campos->sql());
51
+	}
52
+
53
+	//Clase CamposyTabla
54
+
55
+	public function testCamposYTablaDevuelveValorCorrecto()
56
+	{
57
+		$tabla = new Tabla('prueba');
58
+		$campos = new Campos(['a,b,c,d']);
59
+
60
+		$camposytabla = new CamposYTabla($campos,$tabla);
61
+
62
+		$this->assertSame('a,b,c,d FROM prueba',$camposytabla->sql());
63
+	}
64
+
65
+	//Clase ValidadorDeParametrosWhere
66
+
67
+	public function testValidadorDeParametrosWhereElArrayNoPuedeEstarVacio()
68
+	{
69
+		$this->expectException(Exception::class);
70
+		new ValidadorDeParametrosWhere([]);
71
+	}
72
+
73
+	public function testValidadorDeParametrosWhereLaColumnaSoloPuedeSerString()
74
+	{
75
+		$this->expectException(Exception::class);
76
+		new ValidadorDeParametrosWhere([1,'1','2']);
77
+	}
78
+
79
+	public function testValidadorDeParametrosWhereNingunCampoPuedeEstarVacio()
80
+	{
81
+		$this->expectException(Exception::class);
82
+		new ValidadorDeParametrosWhere(['','1','2']);
83
+	}
84
+
85
+	//Clase ValidadorDeParametrosWhereBetween
86
+
87
+	public function testValidadorDeParametrosWhereBetweenElArrayNoPuedeEstarVacio()
88
+	{
89
+		$this->expectException(Exception::class);
90
+		new ValidadorDeParametrosWhereBetween([]);
91
+	}
92
+
93
+	public function testValidadorDeParametrosWhereBetweenNoPuedeTenerValoresIguales()
94
+	{
95
+		$this->expectException(Exception::class);
96
+		new ValidadorDeParametrosWhereBetween(['id','1','1']);
97
+	}
98
+
99
+	public function testValidadorDeParametrosWhereBetweenLaColumnaSoloPuedeSerString()
100
+	{
101
+		$this->expectException(Exception::class);
102
+		new ValidadorDeParametrosWhereBetween([1,'1','2']);
103
+	}
104
+
105
+	public function testValidadorDeParametrosWhereBetweenNingunCampoPuedeEstarVacio()
106
+	{
107
+		$this->expectException(Exception::class);
108
+		new ValidadorDeParametrosWhereBetween(['','1','2']);
109
+	}
110
+
111
+	//Clase Where
112
+
113
+	public function testWhereArrojaStringValido()
114
+	{
115
+		$where = new Where(
116
+			new ValidadorDeParametrosWhere(
117
+				['id','=','21']
118
+			)
119
+			);
120
+
121
+		$this->assertSame('WHERE id = ?', $where->sql());
122
+	}
123
+
124
+	public function testWhereArrojaArrayEnMetodoDatos()
125
+	{
126
+		$where = new Where(
127
+			new ValidadorDeParametrosWhere(
128
+				['id','=','21']
129
+			)
130
+			);
131
+
132
+		$this->assertIsArray($where->datos());
133
+	}
134
+
135
+	//Clase ValidadorDeParametrosWhereAndOthers
136
+
137
+	public function testValidadorDeParametrosWhereAndOthersElArrayNoPuedeEstarVacio()
138
+	{
139
+		$this->expectException(Exception::class);
140
+		new ValidadorDeParametrosWhereAndOthers([]);
141
+	}
142
+
143
+	public function testValidadorDeParametrosWhereAndOthersLaColumnaSoloPuedeSerString()
144
+	{
145
+		$this->expectException(Exception::class);
146
+		new ValidadorDeParametrosWhereAndOthers([1,'=','2','1','=','2']);
147
+	}
148
+
149
+	public function testValidadorDeParametrosWhereAndOthersNingunCampoPuedeEstarVacio()
150
+	{
151
+		$this->expectException(Exception::class);
152
+		new ValidadorDeParametrosWhereAndOthers(['','1','2','','','']);
153
+	}
154
+
155
+	//Clase Where And
156
+
157
+	public function testWhereAndArrojaStringValido()
158
+	{
159
+		$where = new WhereAnd(
160
+			new ValidadorDeParametrosWhereAndOthers(
161
+				['id','=','21','uno','=','1']
162
+			)
163
+			);
164
+
165
+		$this->assertSame('WHERE id = ? AND uno = ?', $where->sql());
166
+	}
167
+
168
+	//Clase Where Or
169
+
170
+	public function testWhereOrArrojaStringValido()
171
+	{
172
+		$where = new WhereOr(
173
+			new ValidadorDeParametrosWhereAndOthers(
174
+				['id','=','21','uno','=','1']
175
+			)
176
+			);
177
+
178
+		$this->assertSame('WHERE id = ? OR uno = ?', $where->sql());
179
+	}
180
+
181
+	//Clase Where Between
182
+
183
+	public function testWhereBetweenArrojaStringValido()
184
+	{
185
+		$where = new WhereBetween(
186
+			new ValidadorDeParametrosWhereBetween(
187
+				['id','1','21']
188
+			)
189
+			);
190
+
191
+		$this->assertSame('WHERE BETWEEN id ? AND ?', $where->sql());
192
+	}
193
+
194
+	//Clase Where Not Between
195
+
196
+	public function testWhereNotBetweenArrojaStringValido()
197
+	{
198
+		$where = new WhereNotBetween(
199
+			new ValidadorDeParametrosWhereBetween(
200
+				['id','1','21']
201
+			)
202
+			);
203
+
204
+		$this->assertSame('WHERE NOT BETWEEN id ? AND ?', $where->sql());
205
+	}
206
+
207
+	//Clase Como 
208
+
209
+	public function testComoArrojaStringValido()
210
+	{
211
+		$where = new WhereNotBetween(
212
+			new ValidadorDeParametrosWhereBetween(
213
+				['id','1','21']
214
+			)
215
+			);
216 216
         
217
-        $como = new Como(
218
-            $where
219
-        );
220
-
221
-        $this->assertSame('WHERE NOT BETWEEN id ? AND ?', $como->sql());
222
-    }
223
-
224
-    //Clase Sentencia Select Where
225
-
226
-    public function testSentenciaSelectWhereArrojaStringValido()
227
-    {
228
-        $where = new WhereNotBetween(
229
-            new ValidadorDeParametrosWhereBetween(
230
-                ['id','1','21']
231
-            )
232
-            );
217
+		$como = new Como(
218
+			$where
219
+		);
220
+
221
+		$this->assertSame('WHERE NOT BETWEEN id ? AND ?', $como->sql());
222
+	}
223
+
224
+	//Clase Sentencia Select Where
225
+
226
+	public function testSentenciaSelectWhereArrojaStringValido()
227
+	{
228
+		$where = new WhereNotBetween(
229
+			new ValidadorDeParametrosWhereBetween(
230
+				['id','1','21']
231
+			)
232
+			);
233 233
         
234
-        $como = new Como(
235
-            $where
236
-        );
237
-
238
-        $sentencia = new SentenciaSelectWhere(
239
-            new CamposYTabla(
240
-                new Campos(['*']),
241
-                new Tabla('prueba')
242
-            ),$como
243
-        );
244
-
245
-        $this->assertSame('SELECT * FROM prueba WHERE NOT BETWEEN id ? AND ?', $sentencia->sql());
246
-    }
247
-
248
-    //Clase SentenciaSelect
249
-
250
-    public function testSentenciaSelectArrojaStringValido()
251
-    {
252
-        $sentencia = new SentenciaSelect(
253
-            new CamposYTabla(
254
-                new Campos(['*']),
255
-                new Tabla('prueba')
256
-                )
257
-            );
258
-
259
-        $this->assertSame('SELECT * FROM prueba', $sentencia->sql());
260
-    }
234
+		$como = new Como(
235
+			$where
236
+		);
237
+
238
+		$sentencia = new SentenciaSelectWhere(
239
+			new CamposYTabla(
240
+				new Campos(['*']),
241
+				new Tabla('prueba')
242
+			),$como
243
+		);
244
+
245
+		$this->assertSame('SELECT * FROM prueba WHERE NOT BETWEEN id ? AND ?', $sentencia->sql());
246
+	}
247
+
248
+	//Clase SentenciaSelect
249
+
250
+	public function testSentenciaSelectArrojaStringValido()
251
+	{
252
+		$sentencia = new SentenciaSelect(
253
+			new CamposYTabla(
254
+				new Campos(['*']),
255
+				new Tabla('prueba')
256
+				)
257
+			);
258
+
259
+		$this->assertSame('SELECT * FROM prueba', $sentencia->sql());
260
+	}
261 261
 }
262 262
\ No newline at end of file
Please login to merge, or discard this patch.
src/pdodatabase/elementos/ValidadorDeParametrosWhereAndOthers.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         foreach ($array as $value)
48 48
         {
49
-            if(empty($value))
49
+            if (empty($value))
50 50
             {
51 51
                 throw new Exception("Error Processing Request");
52 52
             }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     private function columnasSonString($array): void
57 57
     {
58
-        if(!is_string($array[0]) || !is_string($array[3]))
58
+        if (!is_string($array[0]) || !is_string($array[3]))
59 59
         {
60 60
             throw new Exception("Error Processing Request");
61 61
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     private function numeroDeElementosValido($array): void
65 65
     {
66
-        if(count($array) !== 6)
66
+        if (count($array) !== 6)
67 67
         {
68 68
             throw new Exception("Error Processing Request");
69 69
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     private function operadorValido($array): void
73 73
     {
74
-        if(!in_array($array[1], $this->_operadoresValidos) || !in_array($array[4], $this->_operadoresValidos))
74
+        if (!in_array($array[1], $this->_operadoresValidos) || !in_array($array[4], $this->_operadoresValidos))
75 75
         {
76 76
             throw new Exception("Error Processing Request");
77 77
         }
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -6,75 +6,75 @@
 block discarded – undo
6 6
 
7 7
 class ValidadorDeParametrosWhereAndOthers implements ValidadorDeParametrosInterface
8 8
 {
9
-    private $_operadoresValidos = [
10
-        '=',
11
-        '>',
12
-        '<',
13
-        '>=',
14
-        '<=',
15
-        '<>',
16
-        '!=',
17
-        '!<',
18
-        '!>',
19
-        'LIKE',
20
-        'IN',
21
-    ];
9
+	private $_operadoresValidos = [
10
+		'=',
11
+		'>',
12
+		'<',
13
+		'>=',
14
+		'<=',
15
+		'<>',
16
+		'!=',
17
+		'!<',
18
+		'!>',
19
+		'LIKE',
20
+		'IN',
21
+	];
22 22
 
23
-    private $_datos;
23
+	private $_datos;
24 24
 
25
-    public function __construct(array $datos)
26
-    {
27
-        $this->_datos = $this->setDatos($datos);
28
-    }
25
+	public function __construct(array $datos)
26
+	{
27
+		$this->_datos = $this->setDatos($datos);
28
+	}
29 29
 
30
-    public function datos(): array
31
-    {
32
-        return $this->_datos;
33
-    }
30
+	public function datos(): array
31
+	{
32
+		return $this->_datos;
33
+	}
34 34
 
35
-    private function setDatos($array): array
36
-    {
37
-        $this->numeroDeElementosValido($array);
38
-        $this->contieneValoresVacios($array);
39
-        $this->columnasSonString($array);
40
-        $this->operadorValido($array);
35
+	private function setDatos($array): array
36
+	{
37
+		$this->numeroDeElementosValido($array);
38
+		$this->contieneValoresVacios($array);
39
+		$this->columnasSonString($array);
40
+		$this->operadorValido($array);
41 41
 
42
-        return $array;
43
-    }
42
+		return $array;
43
+	}
44 44
 
45
-    private function contieneValoresVacios($array): void
46
-    {
47
-        foreach ($array as $value)
48
-        {
49
-            if(empty($value))
50
-            {
51
-                throw new Exception("Error Processing Request");
52
-            }
53
-        }
54
-    }
45
+	private function contieneValoresVacios($array): void
46
+	{
47
+		foreach ($array as $value)
48
+		{
49
+			if(empty($value))
50
+			{
51
+				throw new Exception("Error Processing Request");
52
+			}
53
+		}
54
+	}
55 55
 
56
-    private function columnasSonString($array): void
57
-    {
58
-        if(!is_string($array[0]) || !is_string($array[3]))
59
-        {
60
-            throw new Exception("Error Processing Request");
61
-        }
62
-    }
56
+	private function columnasSonString($array): void
57
+	{
58
+		if(!is_string($array[0]) || !is_string($array[3]))
59
+		{
60
+			throw new Exception("Error Processing Request");
61
+		}
62
+	}
63 63
 
64
-    private function numeroDeElementosValido($array): void
65
-    {
66
-        if(count($array) !== 6)
67
-        {
68
-            throw new Exception("Error Processing Request");
69
-        }
70
-    }
64
+	private function numeroDeElementosValido($array): void
65
+	{
66
+		if(count($array) !== 6)
67
+		{
68
+			throw new Exception("Error Processing Request");
69
+		}
70
+	}
71 71
 
72
-    private function operadorValido($array): void
73
-    {
74
-        if(!in_array($array[1], $this->_operadoresValidos) || !in_array($array[4], $this->_operadoresValidos))
75
-        {
76
-            throw new Exception("Error Processing Request");
77
-        }
78
-    }
72
+	private function operadorValido($array): void
73
+	{
74
+		if(!in_array($array[1], $this->_operadoresValidos) || !in_array($array[4], $this->_operadoresValidos))
75
+		{
76
+			throw new Exception("Error Processing Request");
77
+		}
78
+	}
79 79
 
80 80
 }
81 81
\ No newline at end of file
Please login to merge, or discard this patch.
Index.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 declare(strict_types=1);
3 3
 phpinfo();
4 4
 die();
5
-require_once __DIR__ . '/vendor/autoload.php';
5
+require_once __DIR__.'/vendor/autoload.php';
6 6
 
7 7
 use src\Factory;
8 8
 use src\pdodatabase\resultados\ContarResultados;
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 
17 17
 // SELECT * FROM prueba
18 18
 
19
-$select = $factory->crear('src\factory\SelectWhere',[
19
+$select = $factory->crear('src\factory\SelectWhere', [
20 20
     'tabla' => 'prueba',
21 21
     'campos' => ['*'],
22
-    'where' => ['id','=','42']
22
+    'where' => ['id', '=', '42']
23 23
 ]);
24 24
 
25 25
 $select = $select->obtener();
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
 // SELECT * FROM prueba
18 18
 
19 19
 $select = $factory->crear('src\factory\SelectWhere',[
20
-    'tabla' => 'prueba',
21
-    'campos' => ['*'],
22
-    'where' => ['id','=','42']
20
+	'tabla' => 'prueba',
21
+	'campos' => ['*'],
22
+	'where' => ['id','=','42']
23 23
 ]);
24 24
 
25 25
 $select = $select->obtener();
Please login to merge, or discard this patch.
test/ConexionTest.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,53 +11,53 @@
 block discarded – undo
11 11
 
12 12
 class ConexionTest extends TestCase
13 13
 {
14
-    //Base de datos
15
-
16
-    public function testBaseDeDatosNoPuedeEstarVacia()
17
-    {
18
-        $this->expectException(Exception::class);
19
-        $base = new BaseDeDatos('');
20
-    }
21
-
22
-    public function testBaseDeDatosSoloDevuelveString()
23
-    {
24
-        $base = new BaseDeDatos('test');
25
-        $this->assertIsString($base->baseDeDatos());
26
-    }
27
-
28
-    //Contraseña
29
-
30
-    public function testContraseñaSoloDevuelveString()
31
-    {
32
-        $base = new ContraseñaBaseDeDatos('23');
33
-        $this->assertIsString($base->contraseñaBaseDeDatos());
34
-    }
35
-
36
-    //Host
37
-
38
-    public function testHostBaseDeDatosNoPuedeEstarVacia()
39
-    {
40
-        $this->expectException(Exception::class);
41
-        $base = new HostBaseDeDatos('');
42
-    }
43
-
44
-    public function testHostSoloDevuelveString()
45
-    {
46
-        $base = new HostBaseDeDatos('23');
47
-        $this->assertIsString($base->hostBaseDeDatos());
48
-    }
49
-
50
-    // usuario
51
-
52
-    public function testUsuarioBaseDeDatosNoPuedeEstarVacia()
53
-    {
54
-        $this->expectException(Exception::class);
55
-        $base = new UsuarioBaseDeDatos('');
56
-    }
57
-
58
-    public function testUsuarioSoloDevuelveString()
59
-    {
60
-        $base = new UsuarioBaseDeDatos('23');
61
-        $this->assertIsString($base->usuarioBaseDeDatos());
62
-    }
14
+	//Base de datos
15
+
16
+	public function testBaseDeDatosNoPuedeEstarVacia()
17
+	{
18
+		$this->expectException(Exception::class);
19
+		$base = new BaseDeDatos('');
20
+	}
21
+
22
+	public function testBaseDeDatosSoloDevuelveString()
23
+	{
24
+		$base = new BaseDeDatos('test');
25
+		$this->assertIsString($base->baseDeDatos());
26
+	}
27
+
28
+	//Contraseña
29
+
30
+	public function testContraseñaSoloDevuelveString()
31
+	{
32
+		$base = new ContraseñaBaseDeDatos('23');
33
+		$this->assertIsString($base->contraseñaBaseDeDatos());
34
+	}
35
+
36
+	//Host
37
+
38
+	public function testHostBaseDeDatosNoPuedeEstarVacia()
39
+	{
40
+		$this->expectException(Exception::class);
41
+		$base = new HostBaseDeDatos('');
42
+	}
43
+
44
+	public function testHostSoloDevuelveString()
45
+	{
46
+		$base = new HostBaseDeDatos('23');
47
+		$this->assertIsString($base->hostBaseDeDatos());
48
+	}
49
+
50
+	// usuario
51
+
52
+	public function testUsuarioBaseDeDatosNoPuedeEstarVacia()
53
+	{
54
+		$this->expectException(Exception::class);
55
+		$base = new UsuarioBaseDeDatos('');
56
+	}
57
+
58
+	public function testUsuarioSoloDevuelveString()
59
+	{
60
+		$base = new UsuarioBaseDeDatos('23');
61
+		$this->assertIsString($base->usuarioBaseDeDatos());
62
+	}
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
src/interfaces/ValidadorDeParametrosInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,6 +3,6 @@
 block discarded – undo
3 3
 
4 4
 interface ValidadorDeParametrosInterface
5 5
 {
6
-    public function __construct(array $datos);
7
-    public function datos(): array;
6
+	public function __construct(array $datos);
7
+	public function datos(): array;
8 8
 }
9 9
\ No newline at end of file
Please login to merge, or discard this patch.