当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Util_XML::load方法代码示例

本文整理汇总了PHP中PHPUnit_Util_XML::load方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_XML::load方法的具体用法?PHP PHPUnit_Util_XML::load怎么用?PHP PHPUnit_Util_XML::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Util_XML的用法示例。


在下文中一共展示了PHPUnit_Util_XML::load方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assertNotTag

 /**
  * Note: we are overriding this method to remove the deprecated error
  * @see https://tracker.moodle.org/browse/MDL-47129
  *
  * @param  array   $matcher
  * @param  string  $actual
  * @param  string  $message
  * @param  boolean $ishtml
  *
  * @deprecated 3.0
  */
 public static function assertNotTag($matcher, $actual, $message = '', $ishtml = true)
 {
     $dom = PHPUnit_Util_XML::load($actual, $ishtml);
     $tags = self::findNodes($dom, $matcher, $ishtml);
     $matched = count($tags) > 0 && $tags[0] instanceof DOMNode;
     self::assertFalse($matched, $message);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:18,代码来源:base_testcase.php

示例2: testToOptionArray

 public function testToOptionArray()
 {
     $this->dispatch('backend/admin/system_config/edit/section/admin');
     $dom = PHPUnit_Util_XML::load($this->getResponse()->getBody(), true);
     $select = $dom->getElementById('admin_startup_menu_item_id');
     $this->assertNotEmpty($select, 'Startup Page select missed');
     $options = $select->getElementsByTagName('option');
     $optionsCount = $options->length;
     $this->assertGreaterThan(0, $optionsCount, 'There must be present menu items at the admin backend');
     $this->assertEquals('Dashboard', $options->item(0)->nodeValue, 'First element is not Dashboard');
     $this->assertContains('Configuration', $options->item($optionsCount - 1)->nodeValue);
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:12,代码来源:PageTest.php

示例3: assertNotTag

 /**
  * This assertion is the exact opposite of assertTag().
  *
  * Rather than asserting that $matcher results in a match, it asserts that
  * $matcher does not match.
  *
  * @param array  $matcher
  * @param string $actual
  * @param string $message
  * @param bool   $isHtml
  * @since  Method available since Release 3.3.0
  * @author Mike Naberezny <mike@maintainable.com>
  * @author Derek DeVries <derek@maintainable.com>
  * @deprecated
  */
 public static function assertNotTag($matcher, $actual, $message = '', $isHtml = true)
 {
     trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
     $dom = PHPUnit_Util_XML::load($actual, $isHtml);
     $tags = PHPUnit_Util_XML::findNodes($dom, $matcher, $isHtml);
     $matched = count($tags) > 0 && $tags[0] instanceof DOMNode;
     self::assertFalse($matched, $message);
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:23,代码来源:Assert.php

示例4: tagMatch

 /**
  * @param array $matcher
  * @param string $actual
  * @param bool $isHtml
  *
  * @return bool
  */
 private static function tagMatch($matcher, $actual, $isHtml = true)
 {
     $dom = PHPUnit_Util_XML::load($actual, $isHtml);
     $tags = PHPUnit_Util_XML::findNodes($dom, $matcher, $isHtml);
     return count($tags) > 0 && $tags[0] instanceof DOMNode;
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:13,代码来源:MediaWikiTestCase.php

示例5: assertXmlStringNotEqualsXmlString

 /**
  * Asserts that two XML documents are not equal.
  *
  * @param string $expectedXml
  * @param string $actualXml
  * @param string $message
  *
  * @since  Method available since Release 3.1.0
  */
 public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = '')
 {
     $expected = PHPUnit_Util_XML::load($expectedXml);
     $actual = PHPUnit_Util_XML::load($actualXml);
     self::assertNotEquals($expected, $actual, $message);
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:15,代码来源:Assert.php

示例6: runSelenese

 /**
  * Runs a test from a Selenese (HTML) specification.
  *
  * @param string $filename
  * @access public
  */
 public function runSelenese($filename)
 {
     $document = PHPUnit_Util_XML::load($filename, TRUE);
     $xpath = new DOMXPath($document);
     $rows = $xpath->query('body/table/tbody/tr');
     foreach ($rows as $row) {
         $action = NULL;
         $arguments = array();
         $columns = $xpath->query('td', $row);
         foreach ($columns as $column) {
             if ($action === NULL) {
                 $action = $column->nodeValue;
             } else {
                 $arguments[] = $column->nodeValue;
             }
         }
         $this->__call($action, $arguments);
     }
 }
开发者ID:humansky,项目名称:qframe,代码行数:25,代码来源:SeleniumTestCase.php

示例7: __construct

 /**
  * Loads a PHPUnit configuration file.
  *
  * @param  string $filename
  */
 public function __construct($filename)
 {
     $this->document = PHPUnit_Util_XML::load($filename);
     $this->xpath = new DOMXPath($this->document);
 }
开发者ID:xiplias,项目名称:pails,代码行数:10,代码来源:Configuration.php

示例8: testLoadBoolean

 /**
  * @expectedException PHPUnit_Framework_Exception
  * @expectedExceptionMessage Could not load XML from boolean
  */
 public function testLoadBoolean()
 {
     PHPUnit_Util_XML::load(false);
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:8,代码来源:XMLTest.php

示例9: equalValues

 protected function equalValues()
 {
     // cyclic dependencies
     $book1 = new Book();
     $book1->author = new Author('Terry Pratchett');
     $book1->author->books[] = $book1;
     $book2 = new Book();
     $book2->author = new Author('Terry Pratchett');
     $book2->author->books[] = $book2;
     $object1 = new SampleClass(4, 8, 15);
     $object2 = new SampleClass(4, 8, 15);
     $storage1 = new SplObjectStorage();
     $storage1->attach($object1);
     $storage2 = new SplObjectStorage();
     $storage2->attach($object1);
     return array(array('a', 'A', 0, false, true), array(array('a' => 1, 'b' => 2), array('b' => 2, 'a' => 1)), array(array(1), array('1')), array(array(3, 2, 1), array(2, 3, 1), 0, true), array(2.3, 2.5, 0.5), array(array(2.3), array(2.5), 0.5), array(array(array(2.3)), array(array(2.5)), 0.5), array(new Struct(2.3), new Struct(2.5), 0.5), array(array(new Struct(2.3)), array(new Struct(2.5)), 0.5), array(1, 2, 1), array($object1, $object2), array($book1, $book2), array($storage1, $storage2), array(PHPUnit_Util_XML::load('<root></root>'), PHPUnit_Util_XML::load('<root/>')), array(PHPUnit_Util_XML::load('<root attr="bar"></root>'), PHPUnit_Util_XML::load('<root attr="bar"/>')), array(PHPUnit_Util_XML::load('<root><foo attr="bar"></foo></root>'), PHPUnit_Util_XML::load('<root><foo attr="bar"/></root>')), array(PHPUnit_Util_XML::load("<root>\n  <child/>\n</root>"), PHPUnit_Util_XML::load('<root><child/></root>')), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York'))), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:13:25', new DateTimeZone('America/New_York')), 10), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:14:40', new DateTimeZone('America/New_York')), 65), array(new DateTime('2013-03-29', new DateTimeZone('America/New_York')), new DateTime('2013-03-29', new DateTimeZone('America/New_York'))), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 03:13:35', new DateTimeZone('America/Chicago'))), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 03:13:49', new DateTimeZone('America/Chicago')), 15), array(new DateTime('2013-03-30', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 23:00:00', new DateTimeZone('America/Chicago'))), array(new DateTime('2013-03-30', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 23:01:30', new DateTimeZone('America/Chicago')), 100), array(new DateTime('@1364616000'), new DateTime('2013-03-29 23:00:00', new DateTimeZone('America/Chicago'))), array(new DateTime('2013-03-29T05:13:35-0500'), new DateTime('2013-03-29T04:13:35-0600')), array(0, '0'), array('0', 0), array(2.3, '2.3'), array('2.3', 2.3), array((string) (1 / 3), 1 - 2 / 3), array(1 / 3, (string) (1 - 2 / 3)), array('string representation', new ClassWithToString()), array(new ClassWithToString(), 'string representation'));
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:17,代码来源:AssertTest.php

示例10: equalValues

 protected function equalValues()
 {
     // cyclic dependencies
     $book1 = new Book();
     $book1->author = new Author('Terry Pratchett');
     $book1->author->books[] = $book1;
     $book2 = new Book();
     $book2->author = new Author('Terry Pratchett');
     $book2->author->books[] = $book2;
     $object1 = new SampleClass(4, 8, 15);
     $object2 = new SampleClass(4, 8, 15);
     $storage1 = new SplObjectStorage();
     $storage1->attach($object1);
     $storage2 = new SplObjectStorage();
     $storage2->attach($object1);
     return [['a', 'A', 0, false, true], [['a' => 1, 'b' => 2], ['b' => 2, 'a' => 1]], [[1], ['1']], [[3, 2, 1], [2, 3, 1], 0, true], [2.3, 2.5, 0.5], [[2.3], [2.5], 0.5], [[[2.3]], [[2.5]], 0.5], [new Struct(2.3), new Struct(2.5), 0.5], [[new Struct(2.3)], [new Struct(2.5)], 0.5], [1, 2, 1], [$object1, $object2], [$book1, $book2], [$storage1, $storage2], [PHPUnit_Util_XML::load('<root></root>'), PHPUnit_Util_XML::load('<root/>')], [PHPUnit_Util_XML::load('<root attr="bar"></root>'), PHPUnit_Util_XML::load('<root attr="bar"/>')], [PHPUnit_Util_XML::load('<root><foo attr="bar"></foo></root>'), PHPUnit_Util_XML::load('<root><foo attr="bar"/></root>')], [PHPUnit_Util_XML::load("<root>\n  <child/>\n</root>"), PHPUnit_Util_XML::load('<root><child/></root>')], [new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York'))], [new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:13:25', new DateTimeZone('America/New_York')), 10], [new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:14:40', new DateTimeZone('America/New_York')), 65], [new DateTime('2013-03-29', new DateTimeZone('America/New_York')), new DateTime('2013-03-29', new DateTimeZone('America/New_York'))], [new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 03:13:35', new DateTimeZone('America/Chicago'))], [new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 03:13:49', new DateTimeZone('America/Chicago')), 15], [new DateTime('2013-03-30', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 23:00:00', new DateTimeZone('America/Chicago'))], [new DateTime('2013-03-30', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 23:01:30', new DateTimeZone('America/Chicago')), 100], [new DateTime('@1364616000'), new DateTime('2013-03-29 23:00:00', new DateTimeZone('America/Chicago'))], [new DateTime('2013-03-29T05:13:35-0500'), new DateTime('2013-03-29T04:13:35-0600')], [0, '0'], ['0', 0], [2.3, '2.3'], ['2.3', 2.3], [(string) (1 / 3), 1 - 2 / 3], [1 / 3, (string) (1 - 2 / 3)], ['string representation', new ClassWithToString()], [new ClassWithToString(), 'string representation']];
 }
开发者ID:hatelove,项目名称:TDD_DAY1_HOMEWORK,代码行数:17,代码来源:AssertTest.php

示例11: notEqualValues

 protected function notEqualValues()
 {
     // cyclic dependencies
     $book1 = new Book();
     $book1->author = new Author('Terry Pratchett');
     $book1->author->books[] = $book1;
     $book2 = new Book();
     $book2->author = new Author('Terry Pratch');
     $book2->author->books[] = $book2;
     $book3 = new Book();
     $book3->author = 'Terry Pratchett';
     $book4 = new stdClass();
     $book4->author = 'Terry Pratchett';
     $object1 = new SampleClass(4, 8, 15);
     $object2 = new SampleClass(16, 23, 42);
     $object3 = new SampleClass(4, 8, 15);
     $storage1 = new SplObjectStorage();
     $storage1->attach($object1);
     $storage2 = new SplObjectStorage();
     $storage2->attach($object3);
     // same content, different object
     // cannot use $filesDirectory, because neither setUp() nor
     // setUpBeforeClass() are executed before the data providers
     $file = dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml';
     return array(array('a', 'b'), array('a', 'A'), array('9E6666666', '9E7777777'), array(1, 2), array(2, 1), array(2.3, 4.2), array(2.3, 4.2, 0.5), array(array(2.3), array(4.2), 0.5), array(array(array(2.3)), array(array(4.2)), 0.5), array(new Struct(2.3), new Struct(4.2), 0.5), array(array(new Struct(2.3)), array(new Struct(4.2)), 0.5), array(NAN, NAN), array(array(), array(0 => 1)), array(array(0 => 1), array()), array(array(0 => NULL), array()), array(array(0 => 1, 1 => 2), array(0 => 1, 1 => 3)), array(array('a', 'b' => array(1, 2)), array('a', 'b' => array(2, 1))), array(new SampleClass(4, 8, 15), new SampleClass(16, 23, 42)), array($object1, $object2), array($book1, $book2), array($book3, $book4), array(fopen($file, 'r'), fopen($file, 'r')), array($storage1, $storage2), array(PHPUnit_Util_XML::load('<root></root>'), PHPUnit_Util_XML::load('<bar/>')), array(PHPUnit_Util_XML::load('<foo attr1="bar"/>'), PHPUnit_Util_XML::load('<foo attr1="foobar"/>')), array(PHPUnit_Util_XML::load('<foo> bar </foo>'), PHPUnit_Util_XML::load('<foo />')), array(PHPUnit_Util_XML::load('<foo xmlns="urn:myns:bar"/>'), PHPUnit_Util_XML::load('<foo xmlns="urn:notmyns:bar"/>')), array(PHPUnit_Util_XML::load('<foo> bar </foo>'), PHPUnit_Util_XML::load('<foo> bir </foo>')), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 03:13:35', new DateTimeZone('America/New_York'))), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 03:13:35', new DateTimeZone('America/New_York')), 3500), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 05:13:35', new DateTimeZone('America/New_York')), 3500), array(new DateTime('2013-03-29', new DateTimeZone('America/New_York')), new DateTime('2013-03-30', new DateTimeZone('America/New_York'))), array(new DateTime('2013-03-29', new DateTimeZone('America/New_York')), new DateTime('2013-03-30', new DateTimeZone('America/New_York')), 43200), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/Chicago'))), array(new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York')), new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/Chicago')), 3500), array(new DateTime('2013-03-30', new DateTimeZone('America/New_York')), new DateTime('2013-03-30', new DateTimeZone('America/Chicago'))), array(new DateTime('2013-03-29T05:13:35-0600'), new DateTime('2013-03-29T04:13:35-0600')), array(new DateTime('2013-03-29T05:13:35-0600'), new DateTime('2013-03-29T05:13:35-0500')), array(new SampleClass(4, 8, 15), FALSE), array(FALSE, new SampleClass(4, 8, 15)), array(array(0 => 1, 1 => 2), FALSE), array(FALSE, array(0 => 1, 1 => 2)), array(array(), new stdClass()), array(new stdClass(), array()), array(0, 'Foobar'), array('Foobar', 0), array(3, acos(8)), array(acos(8), 3));
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:26,代码来源:AssertTest.php

示例12: __construct

 private function __construct($testCase, $html)
 {
     $this->testCase = $testCase;
     $this->doc = PHPUnit_Util_XML::load($html, true);
     $this->domxpath = new DOMXPath($this->doc);
 }
开发者ID:rsaugier,项目名称:ytest,代码行数:6,代码来源:yTest_Dom.php

示例13: assertSelect

 /**
  * CSS-style selector-based assertion that makes [[assertTag()]] look quite cumbersome.
  * The first argument is a string that is essentially a standard CSS selectors used to
  * match the element we want:
  *
  *  - `div`             : an element of type `div`
  *  - `div.class_nm`    : an element of type `div` whose class is `warning`
  *  - `div#myid`        : an element of type `div` whose ID equal to `myid`
  *  - `div[foo="bar"]`  : an element of type `div` whose `foo` attribute value is exactly
  *                        equal to `bar`
  *  - `div[foo~="bar"]` : an element of type `div` whose `foo` attribute value is a list
  *                        of space-separated values, one of which is exactly equal
  *                        to `bar`
  *  - `div[foo*="bar"]` : an element of type `div` whose `foo` attribute value contains
  *                        the substring `bar`
  *  - `div span`        : an span element descendant of a `div` element
  *  - `div > span`      : a span element which is a direct child of a `div` element
  *
  * We can also do combinations to any degree:
  *
  *  - `div#folder.open a[href="http://foo"][title="bar"].selected.big > span`
  *
  * The second argument determines what we're matching in the content or number of tags.
  * It can be one 4 options:
  *
  *  - `content`    : match the content of the tag
  *  - `true/false` : match if the tag exists/doesn't exist
  *  - `number`     : match a specific number of elements
  *  - `range`      : to match a range of elements, we can use an array with the options
  *                         `>` and `<`.
  *
  * {{code: php
  *     ...
  *     
  *     // There is an element with the id "binder_1" with the content "Test Foo"
  *     $this->assertSelect("#binder_1", "Test Foo");
  *     
  *     // There are 10 div elements with the class folder:
  *     $this->assertSelect("div.folder", 10);
  *     
  *     // There are more than 2, less than 10 li elements
  *     $this->assertSelect("ul > li", array('>' => 2, '<' => 10));
  *     
  *     // There are more than or exactly 2, less than or exactly 10 li elements
  *     $this->assertSelect("ul > li", array('>=' => 2, '<=' => 10));
  *     
  *     // The "#binder_foo" id exists
  *     $this->assertSelect('#binder_foo");
  *     $this->assertSelect('#binder_foo", true);
  *     
  *     // The "#binder_foo" id DOES NOT exist
  *     $this->assertSelect('#binder_foo", false);
  *     
  *     ...
  * }}
  *
  * @param   string  $selector
  * @param   mixed   $content
  * @param   boolean $exists
  * @param   string  $msg
  * @param   boolean $isHtml
  * @throws  Mad_Test_Exception
  */
 public function assertSelect($selector, $content = true, $exists = true, $msg = null, $isHtml = true)
 {
     if (!method_exists($this, 'assertSelectEquals')) {
         throw new Mad_Test_Exception('PHPUnit selector assertion support required');
     }
     // only parse response into dom once for better performance
     if ($this->_responseDom === null) {
         $body = $this->response->getBody();
         $this->_responseDom = PHPUnit_Util_XML::load($body, $isHtml);
     }
     if (is_string($content)) {
         if (preg_match('!^/.*/.?$!', $content)) {
             $this->assertSelectRegexp($selector, $content, $exists, $this->_responseDom, $msg, $isHtml);
         } else {
             $this->assertSelectEquals($selector, $content, $exists, $this->_responseDom, $msg, $isHtml);
         }
     } else {
         $this->assertSelectCount($selector, $content, $this->_responseDom, $msg, $isHtml);
     }
 }
开发者ID:lerre,项目名称:framework,代码行数:83,代码来源:Functional.php


注:本文中的PHPUnit_Util_XML::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。