/**
  * Proxy setting properties to real objects.
  *
  * @param string $name  Property name.
  * @param mixed  $value Property value.
  *
  * @throws \UnexpectedValueException If property unknown.
  * @return float
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'Diff_Timeout':
             $this->diff->setTimeout($value);
             break;
         case 'Diff_EditCost':
             $this->diff->setEditCost($value);
             break;
         case 'Match_Threshold':
             $this->match->setThreshold($value);
             break;
         case 'Match_Distance':
             $this->match->setDistance($value);
             break;
         case 'Match_MaxBits':
             $this->match->setMaxBits($value);
             break;
         case 'Patch_DeleteThreshold':
             $this->patch->setDeleteTreshold($value);
             break;
         case 'Patch_Margin':
             $this->patch->setMargin($value);
             break;
         default:
             throw new \UnexpectedValueException('Unknown property: ' . $name);
     }
 }
 public function testAddContext()
 {
     $this->p->setMargin(4);
     $patches = $this->p->fromText("@@ -21,4 +21,10 @@\n-jump\n+somersault\n");
     $this->p->addContext($patches[0], "The quick brown fox jumps over the lazy dog.");
     $this->assertEquals("@@ -17,12 +17,18 @@\n fox \n-jump\n+somersault\n s ov\n", (string) $patches[0]);
     // Same, but not enough trailing context.
     $patches = $this->p->fromText("@@ -21,4 +21,10 @@\n-jump\n+somersault\n");
     $this->p->addContext($patches[0], "The quick brown fox jumps.");
     $this->assertEquals("@@ -17,10 +17,16 @@\n fox \n-jump\n+somersault\n s.\n", (string) $patches[0]);
     // Same, but not enough leading context.
     $patches = $this->p->fromText("@@ -3 +3,2 @@\n-e\n+at\n");
     $this->p->addContext($patches[0], "The quick brown fox jumps.");
     $this->assertEquals("@@ -1,7 +1,8 @@\n Th\n-e\n+at\n  qui\n", (string) $patches[0]);
     // Same, but with ambiguity.
     $patches = $this->p->fromText("@@ -3 +3,2 @@\n-e\n+at\n");
     $this->p->addContext($patches[0], "The quick brown fox jumps.  The quick brown fox crashes.");
     $this->assertEquals("@@ -1,27 +1,28 @@\n Th\n-e\n+at\n  quick brown fox jumps. \n", (string) $patches[0]);
 }