コード例 #1
0
 public function testQPMerge()
 {
     $options = array('test1' => 'val1', 'test2' => 'val2');
     $options2 = array('test1' => 'val3', 'test4' => 'val4');
     QueryPathOptions::set($options);
     QueryPathOptions::merge($options2);
     $results = QueryPathOptions::get();
     $this->assertTrue(QueryPathOptions::has('test4'));
     $this->assertEquals('val3', $results['test1']);
 }
コード例 #2
0
ファイル: Options.php プロジェクト: mpstyle/mtoolkit
 /**
  * Merge the provided array with existing options.
  *
  * On duplicate keys, the value in $array will overwrite the
  * value stored in the options.
  *
  * @param array $array
  *  Associative array of options to merge into the existing options.
  */
 static function merge($array)
 {
     self::$options = $array + self::$options;
 }
コード例 #3
0
ファイル: QueryPathTest.php プロジェクト: sdboyer/querypath
 public function testReplaceEntitiesOption()
 {
     $path = '<?xml version="1.0"?><root/>';
     $xml = qp($path, NULL, array('replace_entities' => TRUE))->xml('<foo>&</foo>')->xml();
     $this->assertTrue(strpos($xml, '<foo>&amp;</foo>') !== FALSE);
     $xml = qp($path, NULL, array('replace_entities' => TRUE))->html('<foo>&</foo>')->xml();
     $this->assertTrue(strpos($xml, '<foo>&amp;</foo>') !== FALSE);
     $xml = qp($path, NULL, array('replace_entities' => TRUE))->xhtml('<foo>&</foo>')->xml();
     $this->assertTrue(strpos($xml, '<foo>&amp;</foo>') !== FALSE);
     QueryPathOptions::set(array('replace_entities' => TRUE));
     $this->assertTrue(strpos($xml, '<foo>&amp;</foo>') !== FALSE);
     QueryPathOptions::set(array());
 }