Completed
Push — scrutinizer ( c2ef4a )
by Fabio
21:50
created
tests/unit/Web/TAssetManagerTest.php 1 patch
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,13 +31,16 @@  discard block
 block discarded – undo
31 31
 			self::$app=new TApplication(dirname(__FILE__).'/app');
32 32
 		}
33 33
 
34
-		if (self::$assetDir===null) self::$assetDir= dirname(__FILE__).'/assets';
34
+		if (self::$assetDir===null) {
35
+			self::$assetDir= dirname(__FILE__).'/assets';
36
+		}
35 37
 		// Make asset directory if not exists
36 38
 	    if (!file_exists (self::$assetDir)) {
37
-    		if (is_writable(dirname(self::$assetDir)))
38
-    		  mkdir (self::$assetDir) ;
39
-    		else
40
-    		  throw new Exception ('Directory '.dirname(self::$assetDir).' is not writable');
39
+    		if (is_writable(dirname(self::$assetDir))) {
40
+    		    		  mkdir (self::$assetDir) ;
41
+    		} else {
42
+    		    		  throw new Exception ('Directory '.dirname(self::$assetDir).' is not writable');
43
+    		}
41 44
 	    } elseif (!is_dir (self::$assetDir)) {
42 45
 	       throw new Exception (self::$assetDir.' exists and is not a directory');
43 46
 	    }
@@ -51,12 +54,19 @@  discard block
 block discarded – undo
51 54
 	  clearstatcache();
52 55
 	  if (is_dir($dir)) {
53 56
 	    foreach (scandir($dir) as $content) {
54
-	      if ($content==='.' or $content==='..') continue; // skip . and ..
57
+	      if ($content==='.' or $content==='..') {
58
+	      	continue;
59
+	      }
60
+	      // skip . and ..
55 61
 	      $content=$dir.'/'.$content;
56
-	      if (is_dir($content))
57
-	        $this->removeDirectory ($content); // Recursivly remove directories
58
-	      else
59
-	        unlink ($content); // Remove file
62
+	      if (is_dir($content)) {
63
+	      	        $this->removeDirectory ($content);
64
+	      }
65
+	      // Recursivly remove directories
66
+	      else {
67
+	      	        unlink ($content);
68
+	      }
69
+	      // Remove file
60 70
 	    }
61 71
 	    // Now, directory should be empty, remove it
62 72
 	    rmdir ($dir);
@@ -78,7 +88,9 @@  discard block
 block discarded – undo
78 88
 		self::assertEquals($manager, self::$app->getAssetManager());
79 89
 
80 90
 		// No, remove asset directory, and catch the exception
81
-		if (is_dir(self::$assetDir)) $this->removeDirectory (self::$assetDir);
91
+		if (is_dir(self::$assetDir)) {
92
+			$this->removeDirectory (self::$assetDir);
93
+		}
82 94
 		try {
83 95
 			$manager->init (null);
84 96
 			self::fail ('Expected TConfigurationException not thrown');
Please login to merge, or discard this patch.
tests/unit/Web/THttpResponseTest.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@
 block discarded – undo
11 11
   public static $app=null;
12 12
 
13 13
   public function setUp () {
14
-    if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app');
14
+    if (self::$app===null) {
15
+    	self::$app=new TApplication(dirname(__FILE__).'/app');
16
+    }
15 17
     ob_start();
16 18
   }
17 19
 
Please login to merge, or discard this patch.
tests/unit/Web/TCacheHttpSessionTest.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 		if(!extension_loaded('memcache'))
18 18
 		{
19 19
 			self::markTestSkipped('The memcache extension is not available');
20
-		}
21
-		else
20
+		} else
22 21
 		{
23 22
 			$basePath = dirname(__FILE__).'/app';
24 23
 			$runtimePath = $basePath.'/runtime';
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
         {
49 48
             $session->init(null);
50 49
             $this->fail("Expected TConfigurationException is not raised");
51
-        }
52
-        catch(TConfigurationException $e)
50
+        } catch(TConfigurationException $e)
53 51
         {
54 52
         }
55 53
         unset($session);
@@ -61,8 +59,7 @@  discard block
 block discarded – undo
61 59
             $session->init(null);
62 60
             $this->fail("Expected TConfigurationException is not raised");
63 61
             $session->open();
64
-        }
65
-        catch(TConfigurationException $e)
62
+        } catch(TConfigurationException $e)
66 63
         {
67 64
         }
68 65
         unset($session);
@@ -72,8 +69,7 @@  discard block
 block discarded – undo
72 69
         {
73 70
             self::$session->setCacheModuleID('MyCache');
74 71
             self::$session->init(null);
75
-        }
76
-        catch(TConfigurationException $e)
72
+        } catch(TConfigurationException $e)
77 73
         {
78 74
             $this->fail('TConfigurationException is not expected');
79 75
             self::markTestSkipped('Cannot continue this test');
Please login to merge, or discard this patch.
tests/unit/Web/UI/THtmlWriterTest.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@
 block discarded – undo
47 47
 
48 48
 	public function setUp () {
49 49
 		// We need an output writer, use a TestWriter for this
50
-		if (self::$output===null) self::$output=new TestWriter();
50
+		if (self::$output===null) {
51
+			self::$output=new TestWriter();
52
+		}
51 53
 	}
52 54
 
53 55
 	public function testConstruct() {
Please login to merge, or discard this patch.
tests/unit/Xml/TXmlDocumentTest.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
 
67 67
 	public function testSaveToFile() {
68 68
 		$file=dirname(__FILE__).'/data/tmp.xml';
69
-		if (!is_writable(dirname($file))) self::markTestSkipped(dirname($file).' must be writable for this test');
69
+		if (!is_writable(dirname($file))) {
70
+			self::markTestSkipped(dirname($file).' must be writable for this test');
71
+		}
70 72
 		$xmldoc=new TXmlDocument('1.0','utf-8');
71 73
 		$xmldoc->setTagName('root');
72 74
 		$node=new TXmlElement('node');
@@ -74,6 +76,8 @@  discard block
 block discarded – undo
74 76
 		$xmldoc->getElements()->add($node);
75 77
 		$xmldoc->saveToFile($file);
76 78
 		self::assertTrue(is_file($file));
77
-		if (is_file($file)) unlink ($file);
79
+		if (is_file($file)) {
80
+			unlink ($file);
81
+		}
78 82
 	}
79 83
 }
Please login to merge, or discard this patch.
tests/unit/Data/TDbTransactionTest.php 1 patch
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 Prado::using('System.Data.*');
4 4
 
5
-if(!defined('TEST_DB_FILE'))
5
+if(!defined('TEST_DB_FILE')) {
6 6
 	define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
7
+}
7 8
 
8 9
 /**
9 10
  * @package System.Data.PDO
@@ -39,8 +40,7 @@  discard block
 block discarded – undo
39 40
 			$this->_connection->createCommand($sql)->execute();
40 41
 			$this->fail('Expected exception not raised');
41 42
 			$transaction->commit();
42
-		}
43
-		catch(Exception $e)
43
+		} catch(Exception $e)
44 44
 		{
45 45
 			$this->assertTrue($transaction->Active);
46 46
 			$transaction->rollBack();
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
 			$this->assertTrue($transaction->Active);
63 63
 			$transaction->commit();
64 64
 			$this->assertFalse($transaction->Active);
65
-		}
66
-		catch(Exception $e)
65
+		} catch(Exception $e)
67 66
 		{
68 67
 			$transaction->rollBack();
69 68
 			$this->fail('Unexpected exception');
Please login to merge, or discard this patch.
tests/unit/Data/TDbConnectionTest.php 1 patch
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,10 +2,12 @@  discard block
 block discarded – undo
2 2
 
3 3
 Prado::using('System.Data.*');
4 4
 
5
-if(!defined('TEST_DB_FILE'))
5
+if(!defined('TEST_DB_FILE')) {
6 6
 	define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
7
-if(!defined('TEST_DB_FILE2'))
7
+}
8
+if(!defined('TEST_DB_FILE2')) {
8 9
 	define('TEST_DB_FILE2',dirname(__FILE__).'/db/test2.db');
10
+}
9 11
 
10 12
 /**
11 13
  * @package System.Data.PDO
@@ -55,8 +57,7 @@  discard block
 block discarded – undo
55 57
    			$connection=new TDbConnection('unknown:'.TEST_DB_FILE);
56 58
    			$connection->Active=true;
57 59
    			$this->fail('Expected exception is not raised');
58
-		}
59
-		catch(TDbException $e)
60
+		} catch(TDbException $e)
60 61
 		{
61 62
 		}
62 63
 	}
@@ -68,8 +69,7 @@  discard block
 block discarded – undo
68 69
 		{
69 70
 			$this->_connection2->createCommand($sql);
70 71
 			$this->fail('Expected exception is not raised');
71
-		}
72
-		catch(TDbException $e)
72
+		} catch(TDbException $e)
73 73
 		{
74 74
 		}
75 75
 
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 			$this->_connection1->createCommand($sql)->execute();
88 88
 			$this->fail('Expected exception not raised');
89 89
 			$transaction->commit();
90
-		}
91
-		catch(Exception $e)
90
+		} catch(Exception $e)
92 91
 		{
93 92
 			$transaction->rollBack();
94 93
 			$reader=$this->_connection1->createCommand('SELECT * FROM foo')->query();
Please login to merge, or discard this patch.
tests/unit/Data/TDbDataReaderTest.php 1 patch
Braces   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 Prado::using('System.Data.*');
4 4
 
5
-if(!defined('TEST_DB_FILE'))
5
+if(!defined('TEST_DB_FILE')) {
6 6
 	define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
7
+}
7 8
 
8 9
 class FooRecord extends TComponent
9 10
 {
@@ -107,8 +108,7 @@  discard block
 block discarded – undo
107 108
 		{
108 109
 			$reader->read();
109 110
 			$this->fail('Expected exception is not raised');
110
-		}
111
-		catch(Exception $e)
111
+		} catch(Exception $e)
112 112
 		{
113 113
 		}
114 114
 	}
@@ -131,18 +131,19 @@  discard block
 block discarded – undo
131 131
 	{
132 132
 		$ids=array();
133 133
 		$reader=$this->_connection->createCommand('SELECT * FROM foo')->query();
134
-		foreach($reader as $row)
135
-			$ids[]=$row['id'];
134
+		foreach($reader as $row) {
135
+					$ids[]=$row['id'];
136
+		}
136 137
 		$this->assertEquals(count($ids),2);
137 138
 		$this->assertTrue($ids[0]==='1' && $ids[1]==='2');
138 139
 
139 140
 		try
140 141
 		{
141
-			foreach($reader as $row)
142
-				$ids[]=$row['id'];
142
+			foreach($reader as $row) {
143
+							$ids[]=$row['id'];
144
+			}
143 145
 			$this->fail('Expected exception is not raised');
144
-		}
145
-		catch(TDbException $e)
146
+		} catch(TDbException $e)
146 147
 		{
147 148
 		}
148 149
 	}
Please login to merge, or discard this patch.
tests/unit/Data/TDbCommandTest.php 1 patch
Braces   +7 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 Prado::using('System.Data.*');
4 4
 
5
-if(!defined('TEST_DB_FILE'))
5
+if(!defined('TEST_DB_FILE')) {
6 6
 	define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
7
+}
7 8
 
8 9
 /**
9 10
  * @package System.Data.PDO
@@ -73,8 +74,7 @@  discard block
 block discarded – undo
73 74
 			$command->Text='Bad SQL';
74 75
 			$command->prepare();
75 76
 			$this->fail('Expected exception is not raised');
76
-		}
77
-		catch(TDbException $e)
77
+		} catch(TDbException $e)
78 78
 		{
79 79
 		}
80 80
 	}
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
 			$command=$this->_connection->createCommand('bad SQL');
137 137
 			$command->execute();
138 138
 			$this->fail('Expected exception is not raised');
139
-		}
140
-		catch(TDbException $e)
139
+		} catch(TDbException $e)
141 140
 		{
142 141
 		}
143 142
 	}
@@ -162,8 +161,7 @@  discard block
 block discarded – undo
162 161
 			$command=$this->_connection->createCommand('bad SQL');
163 162
 			$command->query();
164 163
 			$this->fail('Expected exception is not raised');
165
-		}
166
-		catch(TDbException $e)
164
+		} catch(TDbException $e)
167 165
 		{
168 166
 		}
169 167
 	}
@@ -188,8 +186,7 @@  discard block
 block discarded – undo
188 186
 			$command=$this->_connection->createCommand('bad SQL');
189 187
 			$command->queryRow();
190 188
 			$this->fail('Expected exception is not raised');
191
-		}
192
-		catch(TDbException $e)
189
+		} catch(TDbException $e)
193 190
 		{
194 191
 		}
195 192
 	}
@@ -214,8 +211,7 @@  discard block
 block discarded – undo
214 211
 			$command=$this->_connection->createCommand('bad SQL');
215 212
 			$command->queryScalar();
216 213
 			$this->fail('Expected exception is not raised');
217
-		}
218
-		catch(TDbException $e)
214
+		} catch(TDbException $e)
219 215
 		{
220 216
 		}
221 217
 	}
Please login to merge, or discard this patch.