Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Conversation

@thewilkybarkid
Copy link
Contributor

No description provided.

@thewilkybarkid thewilkybarkid added the enhancement New feature or request label Oct 25, 2018
@thewilkybarkid thewilkybarkid added this to the 0.1.0 milestone Oct 25, 2018
@thewilkybarkid thewilkybarkid requested a review from a team as a code owner October 25, 2018 13:54
@thewilkybarkid thewilkybarkid changed the title Add Items and a null implementation Add Items and in-memory/null implementations Oct 29, 2018
use function tests\Libero\ContentApiBundle\capture_output;

abstract class FunctionalTestCase extends TestCase
abstract class FunctionalTestCase extends KernelTestCase
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State (such as InMemoryItems) wasn't be reset. This makes it slower; will see if there's a way to reset the kernel/container and extract the change.

$items->add($item2);

$this->assertCount(2, $items);
$this->assertEquals([$item1, $item2], iterator_to_array($items));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While looking at other implementations (filesystem and DB), this doesn't work. Turns out it only works here as the resource is the same instance as the one provided on input. https://github.com/sebastianbergmann/comparator/blob/71bdaddd52ddb753a144c78289f21abb719aebc4/src/ResourceComparator.php#L43 actually does a strict comparison (resources are converted to a unique identifier, so aren't being compared on their values).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly reading the streams and compare the resulting strings would work here? Which would also cover un-seekable streams like fopen('https://s3.amazonaws.com/bucket/file.xml')

use Traversable;
use function count;

final class ItemList implements Countable, IteratorAggregate

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generic name, could it be Item(s)Page given it contains a pointer to the next element?

*/
public function get(ItemId $id, ?ItemVersionNumber $version = null) : ItemVersion;

public function list(int $limit = 10, ?ItemId $fromId = null) : ItemList;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$fromId can be interpreted as filtering based on that id, could start or similar pagination-related terminology be used?

"symfony/dependency-injection": "^3.4 || ^4.0",
"symfony/framework-bundle": "^3.4 || ^4.0",
"symfony/http-foundation": "^3.4 || ^4.0",
"symfony/http-foundation": "^3.4.13 || ^4.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downside of --prefer-lowest (the problem applies to 4.0.0 and 4.1.0 too).

@thewilkybarkid thewilkybarkid merged commit c102e4e into libero:master Oct 30, 2018
@thewilkybarkid thewilkybarkid deleted the items branch October 30, 2018 13:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants