Skip to content

Commit

Permalink
Deduplicate entries in studio.json
Browse files Browse the repository at this point in the history
Fixes #94.
  • Loading branch information
franzliedke committed Jun 2, 2019
1 parent 27e2c5c commit 32f7b17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions spec/Config/Version2SerializerSpec.php
Expand Up @@ -16,4 +16,9 @@ function it_stores_paths_alphabetically()
{
$this->serializePaths(['foo', 'bar'])->shouldReturn(['paths' => ['bar', 'foo']]);
}

function it_deduplicates_paths()
{
$this->serializePaths(['foo', 'bar', 'foo'])->shouldReturn(['paths' => ['bar', 'foo']]);
}
}
2 changes: 1 addition & 1 deletion src/Config/Version2Serializer.php
Expand Up @@ -12,6 +12,6 @@ public function deserializePaths($obj)
public function serializePaths(array $paths)
{
sort($paths);
return ['paths' => array_values($paths)];
return ['paths' => array_unique(array_values($paths))];
}
}

0 comments on commit 32f7b17

Please sign in to comment.