Browse Source

Small corrections

* Correct doc blocks for OrmCacheShell.
* Fix coding standards errors.
* Add missing default argument value.
* Fix indentation and failing tests.
mark_story 12 years ago
parent
commit
2a959c39a4

+ 5 - 3
src/Console/Command/OrmCacheShell.php

@@ -53,6 +53,7 @@ class OrmCacheShell extends Shell {
 			$schema->describe($table, ['forceRefresh' => true]);
 		}
 		$this->out('<success>Cache build complete</success>');
+		return true;
 	}
 
 /**
@@ -78,7 +79,7 @@ class OrmCacheShell extends Shell {
 
 		foreach ($tables as $table) {
 			$this->_io->verbose(sprintf(
-				'Clearing metadata cache from "%s" for %s', 
+				'Clearing metadata cache from "%s" for %s',
 				$configName,
 				$table
 			));
@@ -86,12 +87,13 @@ class OrmCacheShell extends Shell {
 			Cache::delete($key, $configName);
 		}
 		$this->out('<success>Cache clear complete</success>');
+		return true;
 	}
 
 /**
  * Helper method to get the schema collection.
  *
- * @return \Cake\Database\Schema\Collection
+ * @return false|\Cake\Database\Schema\Collection
  */
 	protected function _getSchema() {
 		$source = ConnectionManager::get($this->params['connection']);
@@ -116,7 +118,7 @@ class OrmCacheShell extends Shell {
 			'help' => 'Clear all metadata caches for the connection. If a ' .
 				'table name is provided, only that table will be removed.',
 		])->addSubcommand('build', [
-		'help' => 'Build all metadata caches for the connection. If a ' .
+			'help' => 'Build all metadata caches for the connection. If a ' .
 			'table name is provided, only that table will be cached.',
 		])->addOption('connection', [
 			'help' => 'The connection to build/clear metadata cache data for.',

+ 1 - 1
src/Database/Schema/Collection.php

@@ -96,7 +96,7 @@ class Collection {
  * @return \Cake\Database\Schema\Table Object with column metadata.
  * @throws \Cake\Database\Exception when table cannot be described.
  */
-	public function describe($name, array $options) {
+	public function describe($name, array $options = []) {
 		$options += ['forceRefresh' => false];
 		$cacheConfig = $this->cacheMetadata();
 		$cacheKey = $this->cacheKey($name);

+ 1 - 1
tests/TestCase/Console/Command/CommandListShellTest.php

@@ -94,7 +94,7 @@ class CommandListShellTest extends TestCase {
 		$expected = "/\[.*TestPluginTwo.*\] example, welcome/";
 		$this->assertRegExp($expected, $output);
 
-		$expected = "/\[.*CORE.*\] bake, i18n, server, test/";
+		$expected = "/\[.*CORE.*\] bake, i18n, orm_cache, server, test/";
 		$this->assertRegExp($expected, $output);
 
 		$expected = "/\[.*app.*\] sample/";

+ 1 - 1
tests/TestCase/Console/Command/CompletionShellTest.php

@@ -112,7 +112,7 @@ class CompletionShellTest extends TestCase {
 		$this->Shell->runCommand(['commands']);
 		$output = $this->out->output;
 
-		$expected = "TestPlugin.example TestPluginTwo.example TestPluginTwo.welcome bake i18n server test sample\n";
+		$expected = "TestPlugin.example TestPluginTwo.example TestPluginTwo.welcome bake i18n orm_cache server test sample\n";
 		$this->assertEquals($expected, $output);
 	}
 

+ 1 - 1
tests/TestCase/Console/Command/OrmCacheShellTest.php

@@ -14,8 +14,8 @@
  */
 namespace Cake\Test\TestCase\Console\Command;
 
-use Cake\Console\Command\OrmCacheShell;
 use Cake\Cache\Cache;
+use Cake\Console\Command\OrmCacheShell;
 use Cake\Datasource\ConnectionManager;
 use Cake\TestSuite\TestCase;