/** * @inheritdoc */ public function accept(ResourceIdentifierInterface $identifier, $record = null, $key = null, ResourceInterface $resource = null) { if (!$this->current) { return true; } return $this->current->getType() == $identifier->getType() && $this->current->getId() == $identifier->getId(); }
/** * @depends testMap */ public function testMapWithTypeConversion(ResourceIdentifierCollection $collection) { $a = 'Alias-A'; $b = 'Alias-B'; $map = [$this->a->getType() => $a, $this->b->getType() => $b]; $expected = [$a => [$this->a->getId()], $b => [$this->b->getId()]]; $this->assertEquals($expected, $collection->map($map)); }
/** * @param ResourceIdentifier $identifier * @param $object * @param $expectation * @return PHPUnit_Framework_MockObject_MockObject */ private function willFind(ResourceIdentifier $identifier, $object, $expectation = null) { $expectation = $expectation ?: $this->any(); $mock = $this->adapter($identifier->getType()); $mock->expects($expectation)->method('find')->with($identifier)->willReturn($object); return $mock; }