/**
  * @dataProvider provideGetEntities
  */
 public function testGetEntities($ids, $expected, $expectedError = false)
 {
     $this->setupGetEntities();
     $idParser = new BasicEntityIdParser();
     // convert string IDs to EntityId objects
     foreach ($ids as $i => $id) {
         if (is_string($id)) {
             $ids[$i] = $idParser->parse($id);
         }
     }
     $entities = false;
     // do it!
     try {
         $entities = $this->repo->getEntities($ids);
         if ($expectedError !== false) {
             $this->fail("expected error: " . $expectedError);
         }
     } catch (MWException $ex) {
         if ($expectedError !== false) {
             $this->assertInstanceOf($expectedError, $ex);
         } else {
             $this->fail("error: " . $ex->getMessage());
         }
     }
     if (!is_array($expected)) {
         // expected some kind of special return value, e.g. false.
         $this->assertEquals($expected, $entities, "return value");
         return;
     } else {
         $this->assertType('array', $entities, "return value");
     }
     // extract map of entity IDs to label arrays.
     /* @var Entity $e  */
     $actual = array();
     foreach ($entities as $key => $e) {
         if (is_object($e)) {
             $actual[$e->getId()->getSerialization()] = $e->getFingerprint()->getLabels()->toTextArray();
         } else {
             $actual[$key] = $e;
         }
     }
     // check that we found the right number of entities
     $this->assertEquals(count($expected), count($actual), "number of entities found");
     foreach ($expected as $id => $labels) {
         // check that thew correct entity was found
         $this->assertArrayHasKey($id, $actual);
         if (is_array($labels)) {
             // check that the entity contains the expected labels
             $this->assertArrayEquals($labels, $actual[$id]);
         } else {
             // typically, $labels would be null here.
             // check that the entity/revision wasn't found
             $this->assertEquals($labels, $actual[$id]);
         }
     }
 }