Преглед на файлове

Fix removal of missing keys

Jordi Boggiano преди 11 години
родител
ревизия
d742ffca4f
променени са 2 файла, в които са добавени 23 реда и са изтрити 0 реда
  1. 2 0
      src/Composer/Json/JsonManipulator.php
  2. 21 0
      tests/Composer/Test/Json/JsonManipulatorTest.php

+ 2 - 0
src/Composer/Json/JsonManipulator.php

@@ -222,6 +222,8 @@ class JsonManipulator
                     }
                 }
             }
+        } else {
+            $childrenClean = $children;
         }
 
         // no child data left, $name was the only key in

+ 21 - 0
tests/Composer/Test/Json/JsonManipulatorTest.php

@@ -347,6 +347,27 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
         }
     }
 }
+'
+            ),
+            'works on undefined ones' => array(
+                '{
+    "repositories": {
+        "main": {
+            "foo": "bar",
+            "bar": "baz"
+        }
+    }
+}',
+                'removenotthere',
+                true,
+                '{
+    "repositories": {
+        "main": {
+            "foo": "bar",
+            "bar": "baz"
+        }
+    }
+}
 '
             ),
             'works on empty repos' => array(