diff --git a/butler.test b/butler.test
index 417a0ac..756c33d 100755
--- a/butler.test
+++ b/butler.test
@@ -221,4 +221,37 @@ class ButlerMockTestCase extends DrupalUnitTestCase {
 
     $this->assertEqual($butler, DrupalContext::getActiveContext(), t('Active context is correct when removing context objects.'));
   }
+  
+  public function testGarbageCollection() {
+    // create a simple butler object
+    $butler = new DrupalContext(new ButlerFakeRequest(array()));
+    $butler->registerHandler('foo', 'ButlerTestCaseHelperThree', array('bar' => 'butler'));
+    $t1 = $butler->lock();
+    
+    // create a new layer on top of that, which overrides some information
+    $b2 = $butler->addLayer();
+    $b2->registerHandler('foo', 'ButlerTestCaseHelperThree', array('bar' => 'b2'));
+    $t2 = $b2->lock();
+    
+    // create a new layer on top of that, which actually does nothing at all
+    $b3 = $b2->addLayer();
+    $t3 = $b3->lock();
+    
+    // get rid of the tracker for b3 
+    unset($t3);
+    
+    // get rid of b2 entirely
+    unset($t2);
+    unset($b2);
+    
+    try {
+      // this should throw an exception
+      $b3['foo:bar'];
+
+      $this->fail(t('Exception not thrown when getting data from a context that should have been destroyed.'));
+    }
+    catch (Exception $e) {
+      $this->pass(t('Exception thrown when getting data from a context that should have been destroyed.'));
+    }
+  }
 }
diff --git a/butler_test.module b/butler_test.module
index e8d849a..b79fab4 100644
--- a/butler_test.module
+++ b/butler_test.module
@@ -22,6 +22,13 @@ class ButlerTestCaseHelperTwo extends ContextHandlerAbstract {
   }
 }
 
+class ButlerTestCaseHelperThree extends ContextHandlerAbstract {
+  public function getValue(array $args = array()) {
+    $param = $args[0];
+    return isset($this->params[$param]) ? $this->params[$param] : NULL;
+  }
+}
+
 class ButlerFakeRequest extends DrupalRequestHttp {
 
   public function __construct($get = array(), $post = array()) {
@@ -36,3 +43,4 @@ class ButlerFakeRequest extends DrupalRequestHttp {
   }
 
 }
+

