示例#1
0
 public function testcliLoadConfig()
 {
     $configFile = \UnitTest\Helpers::getConfigFilenameTPL();
     $cfg = \CB\Install\cliLoadConfig(['config' => $configFile]);
     $realConf = \CB\Config::loadConfigFile($configFile);
     // test if loaded solr_port is equal with real solr_port
     $this->assertEquals($cfg['solr_port'], $realConf['solr_port']);
     $cfg = \CB\Install\cliLoadConfig(['config' => $configFile, 'solr_port' => 8180]);
     $this->assertEquals($cfg['solr_port'], 8180);
     $cfg = \CB\Install\cliLoadConfig(['config' => $configFile, 'su_db_pass' => '1234567', 'core_root_pass' => '1234567']);
     $this->assertEquals($cfg['su_db_pass'], '1234567');
     $this->assertEquals($cfg['core_root_pass'], '1234567');
     $cfg = \CB\Install\cliLoadConfig(['su_db_pass' => '1234567', 'core_root_pass' => '1234567']);
     $this->assertEquals($cfg['su_db_pass'], '1234567');
     $this->assertEquals($cfg['core_root_pass'], '1234567');
 }
示例#2
0
 /**
  * @dataProvider searchDataProvider
  */
 public function testSearch($search)
 {
     $src = new \CB\Search();
     $this->assertTrue(is_numeric($src->ping()));
     $src_response = $src->search('test', 0, 10, []);
     $this->assertEquals('OK', $src_response->getHttpStatusMessage(), $src_response->getHttpStatusMessage());
     $result = Helpers::getIncludeContents(\CB\DOC_ROOT . 'remote/router.php', ['postdata' => $search['postdata']]);
     $result = json_decode($result, true);
     $this->assertArraySubset(json_decode($search['expected_response'], true), $result, false, ' Result:' . print_r($result, true) . PHP_EOL . ' Expected:' . print_r(json_decode($search['expected_response'], true), true));
 }