protected function setUp() { parent::setUp(); $numericValidator = new TestValidator('/^\\d+$/'); $alphabeticValidator = new TestValidator('/^[A-Z]+$/i'); $lengthValidator = new TestValidator('/^.{1,10}$/'); $this->dataTypeFactory = new DataTypeFactory(array('numeric' => 'string', 'alphabetic' => 'string')); $p1 = new PropertyId('p1'); $p2 = new PropertyId('p2'); $this->propertyDataTypeLookup = new InMemoryDataTypeLookup(); $this->propertyDataTypeLookup->setDataTypeForProperty($p1, 'numeric'); $this->propertyDataTypeLookup->setDataTypeForProperty($p2, 'alphabetic'); $this->validatorFactory = $this->getMock('Wikibase\\Repo\\DataTypeValidatorFactory'); $this->validatorFactory->expects($this->any())->method('getValidators')->will($this->returnCallback(function ($dataTypeId) use($numericValidator, $alphabeticValidator, $lengthValidator) { return array($dataTypeId === 'numeric' ? $numericValidator : $alphabeticValidator, $lengthValidator); })); }