Browse Source

Flesh out remaining tests for OrmCacheShell.

mark_story 12 years ago
parent
commit
b0ab9a3e45
1 changed files with 24 additions and 6 deletions
  1. 24 6
      tests/TestCase/Console/Command/OrmCacheShellTest.php

+ 24 - 6
tests/TestCase/Console/Command/OrmCacheShellTest.php

@@ -100,34 +100,52 @@ class OrmCacheShellTest extends TestCase {
  * @return void
  */
 	public function testBuildOverwritesExistingData() {
-		$this->markTestIncomplete();
+		$this->cache->expects($this->once())
+			->method('write')
+			->with('test_articles');
+		$this->cache->expects($this->never())
+			->method('read');
+		$this->cache->expects($this->never())
+			->method('delete');
+
+		$this->shell->params['connection'] = 'test';
+		$this->shell->build('articles');
 	}
 
 /**
  * Test build() with a non-existing connection name.
  *
+ * @expectedException Cake\Datasource\Error\MissingDatasourceConfigException
  * @return void
  */
 	public function testBuildInvalidConnection() {
-		$this->markTestIncomplete();
+		$this->shell->params['connection'] = 'derpy-derp';
+		$this->shell->build('articles');
 	}
 
 /**
- * Test clear() with no args.
+ * Test clear() with an invalid connection name.
  *
+ * @expectedException Cake\Datasource\Error\MissingDatasourceConfigException
  * @return void
  */
 	public function testClearInvalidConnection() {
-		$this->markTestIncomplete();
+		$this->shell->params['connection'] = 'derpy-derp';
+		$this->shell->clear('articles');
 	}
 
 /**
- * Test clear() with once arg.
+ * Test clear() with no args.
  *
  * @return void
  */
 	public function testClearNoArgs() {
-		$this->markTestIncomplete();
+		$this->cache->expects($this->at(2))
+			->method('delete')
+			->with('test_articles');
+
+		$this->shell->params['connection'] = 'test';
+		$this->shell->clear();
 	}
 
 /**