Permalink
Browse files

Small updates in the collector unit tests.

  • Loading branch information...
1 parent 4d0521f commit a193df4a79864044aa4de75b250cef32f133f099 @zyxist zyxist committed Feb 7, 2011
Showing with 25 additions and 0 deletions.
  1. +25 −0 tests/TestSuite/CollectorTest.php
@@ -179,4 +179,29 @@ public function testLoadFromLoaderAsNestedDoesRecursiveMerging()
$this->assertEquals('goo value', $collector->get('bar.goo'));
$this->assertEquals('hoo value', $collector->get('bar.bar.hoo'));
} // end testLoadFromLoaderAsNestedDoesRecursiveMerging();
+
+ /**
+ * @expectedException BadMethodCallException
+ */
+ public function testSaveThrowsExceptionWhenNoCacheIsInstalled()
+ {
+ $collector = new Collector();
+ $collector->save();
+ } // end testSaveThrowsExceptionWhenNoCacheIsInstalled();
+
+ public function testSaveSavesTheDataInTheCache()
+ {
+ $cacheMock = $this->getMockForAbstractClass('\\Opl\\Cache\\Cache', array(0 => array('prefix' => 'mock', 'lifetime' => 100)));
+ $cacheMock->expects($this->once())
+ ->method('set')
+ ->with(
+ $this->equalTo('collector'),
+ $this->equalTo(array('foo' => 'bar'))
+ )
+ ->will($this->returnValue(true));
+
+ $collector = new Collector($cacheMock);
+ $collector->loadFromArray(Collector::ROOT, array('foo' => 'bar'));
+ $collector->save();
+ } // end testSaveSavesTheDataInTheCache();
} // end CollectorTest;

0 comments on commit a193df4

Please sign in to comment.