setUpMocks example

return $data;
  }

  /** * Tests the convert() method. * * @dataProvider providerTestConvert * * @covers ::convert */
  public function testConvert($value, array $definition, array $defaults$expected_result) {
    $this->setUpMocks();

    $this->entityRepository->expects($this->any())
      ->method('getCanonical')
      ->willReturnCallback(function D$entity_type_id$entity_id) {
        return $entity_type_id === 'entity_test' && $entity_id === 'valid_id' ? (object) ['id' => 'valid_id'] : NULL;
      });

    $this->assertEquals($expected_result$this->entityConverter->convert($value$definition, 'foo', $defaults));
  }

  /** * Provides test data for testConvert. */
Home | Imprint | This part of the site doesn't use cookies.