public function MatcherTest::testEngineSort in CRM Core 8.2
Tests the sorting of engines.
File
- modules/
crm_core_match/ tests/ src/ Unit/ MatcherTest.php, line 92 - Contains \Drupal\Tests\crm_core_match\Unit\MatcherTest.
Class
- MatcherTest
- Tests the matcher service.
Namespace
Drupal\Tests\crm_core_match\UnitCode
public function testEngineSort() {
// $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(3))
// ->method('get')
// ->will($this->returnValue(TRUE));
//
// $definitions = array(
// 'a' => array('priority' => 5),
// 'b' => array('priority' => 11),
// 'c' => array('priority' => -1),
// );
// $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->pluginManager->expects($this->at(3))
// ->method('createInstance')
// ->with('c', $definitions['c'])
// ->will($this->returnValue($this->engine['c']));
//
// $engines = $this->matcher->getEngines();
//
// $this->assertTrue(is_array($engines));
// $this->assertTrue(count($engines) == 3);
// $this->assertEquals($this->engine['b'], array_shift($engines));
// $this->assertEquals($this->engine['a'], array_shift($engines));
// $this->assertEquals($this->engine['c'], array_shift($engines));
}