Fix handling of multilines in previous commit
parent
20ef3e3c5b
commit
df7114869b
|
@ -75,7 +75,7 @@ class JsonManipulator
|
||||||
// addcslashes is used to double up backslashes since preg_replace resolves them as back references otherwise, see #1588
|
// addcslashes is used to double up backslashes since preg_replace resolves them as back references otherwise, see #1588
|
||||||
$links = preg_replace('{"'.$packageRegex.'"(\s*:\s*)'.self::$JSON_STRING.'}i', addcslashes(JsonFile::encode($package).'${1}"'.$constraint.'"', '\\'), $links);
|
$links = preg_replace('{"'.$packageRegex.'"(\s*:\s*)'.self::$JSON_STRING.'}i', addcslashes(JsonFile::encode($package).'${1}"'.$constraint.'"', '\\'), $links);
|
||||||
} else {
|
} else {
|
||||||
if (preg_match('#^\s*\{\s*\S+.*?(\s*\}\s*)$#', $links, $match)) {
|
if (preg_match('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
|
||||||
// link missing but non empty links
|
// link missing but non empty links
|
||||||
$links = preg_replace(
|
$links = preg_replace(
|
||||||
'{'.preg_quote($match[1]).'$}',
|
'{'.preg_quote($match[1]).'$}',
|
||||||
|
|
|
@ -16,11 +16,6 @@ use Composer\Config\JsonConfigSource;
|
||||||
use Composer\Json\JsonFile;
|
use Composer\Json\JsonFile;
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
|
|
||||||
/**
|
|
||||||
* JsonConfigSource Test
|
|
||||||
*
|
|
||||||
* @author Beau Simensen <beau@dflydev.com>
|
|
||||||
*/
|
|
||||||
class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase
|
class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private $workingDir;
|
private $workingDir;
|
||||||
|
@ -68,7 +63,6 @@ class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase
|
||||||
$twoOfEverything = $this->fixturePath('composer-two-of-everything.json');
|
$twoOfEverything = $this->fixturePath('composer-two-of-everything.json');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
||||||
$this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-empty', $empty),
|
$this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-empty', $empty),
|
||||||
$this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-oneOfEverything', $oneOfEverything),
|
$this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-oneOfEverything', $oneOfEverything),
|
||||||
$this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-twoOfEverything', $twoOfEverything),
|
$this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-twoOfEverything', $twoOfEverything),
|
||||||
|
@ -125,7 +119,6 @@ class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase
|
||||||
$name,
|
$name,
|
||||||
$after ?: $this->fixturePath('removeLink/'.$fixtureBasename.'-after.json'),
|
$after ?: $this->fixturePath('removeLink/'.$fixtureBasename.'-after.json'),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue