Skip to content

Instantly share code, notes, and snippets.

@symm
Created June 10, 2017 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save symm/420cbc4ee580d9c1f1121130c2b40bd9 to your computer and use it in GitHub Desktop.
Save symm/420cbc4ee580d9c1f1121130c2b40bd9 to your computer and use it in GitHub Desktop.
<?php
function it_decodes_a_json_export_into_a_collection_of_bookmarks()
{
$result = $this->parse(__DIR__ . '/../pinboard_export.json');
$result->shouldHaveType(Collection::class);
$result->shouldHaveCount(3);
$result->shouldContainOnlyInstancesOf(Bookmark::class);
}
public function getMatchers()
{
return [
'containOnlyInstancesOf' => function($collection, $className) {
foreach ($collection as $item) {
if (!$item instanceof $className){
return false;
}
}
return true;
}
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment