public function MatcherTest::testEngineExecution in CRM Core 8.2
Tests the execution of match engines.
File
- modules/
crm_core_match/ tests/ src/ Unit/ MatcherTest.php, line 142 - Contains \Drupal\Tests\crm_core_match\Unit\MatcherTest.
Class
- MatcherTest
- Tests the matcher service.
Namespace
Drupal\Tests\crm_core_match\UnitCode
public function testEngineExecution() {
// $engine_config = $this->getMockBuilder('\Drupal\Core\Config\Config')
// ->disableOriginalConstructor()
// ->getMock();
//
// $this->config->expects($this->once())
// ->method('get')
// ->with('engines')
// ->will($this->returnValue($engine_config));
//
// $engine_config->expects($this->exactly(2))
// ->method('get')
// ->will($this->returnValue(TRUE));
// $definitions = array(
// 'a' => array('priority' => 5),
// 'b' => array('priority' => 11),
// );
// $this->pluginManager->expects($this->once())
// ->method('getDefinitions')
// ->will($this->returnValue($definitions));
//
// $this->pluginManager->expects($this->at(1))
// ->method('createInstance')
// ->with('a', $definitions['a'])
// ->will($this->returnValue($this->engine['a']));
//
// $this->pluginManager->expects($this->at(2))
// ->method('createInstance')
// ->with('b', $definitions['b'])
// ->will($this->returnValue($this->engine['b']));
// $this->engine['a']->expects($this->once())
// ->method('match')
// ->with($this->contact)
// ->will($this->returnValue(array(1, 2, 3, 5, 8, 13)));
//
// $this->engine['b']->expects($this->once())
// ->method('match')
// ->with($this->contact)
// ->will($this->returnValue(array(3, 8, 21, 34)));
// $this->matcher->expects($this->once())
// ->method('match')
// ->with($this->contact)
// ->will($this->)
//
// $ids = $this->matcher->match($this->contact);
// $ids = array_values($ids);
// sort($ids);
// $this->assertEquals(array(1, 2, 3, 5, 8, 13, 21, 34), $ids);
}