How to use __toString method of Subset class

Best Mockery code snippet using Subset.__toString

testSimpleXML.php

Source:testSimpleXML.php Github

copy

Full Screen

...13 public function testDefault_noAttack() {14 15 $data = simplexml_load_file("../../xml_files_windows/standard.xml", $class_name="SimpleXMLElement");16 17 $content = $data->__toString();18 $content = preg_replace('/\s+/', '', $content);19 $this->assertEquals("4", $content);20 }21 22 23 public function testDOS_core() {24 $data = simplexml_load_file("../../xml_files_windows/dos/dos_core.xml",25 $class_name="SimpleXMLElement"26 );27 $content = $data->__toString();28 $content = preg_replace('/\s+/', '', $content);29 $expectedCount = 25;30 $realCount = substr_count($content, 'dos');31 32 $this->assertEquals($expectedCount,$realCount);33 }34/** 35 public function testDOS_core_LIBXML_PARSEHUGE() {36 $data = simplexml_load_file("../../xml_files_windows/dos/dos_core.xml",37 $class_name="SimpleXMLElement",38 $options=LIBXML_PARSEHUGE39 );40 41 $content = $data->__toString();42 $content = preg_replace('/\s+/', '', $content);43 $expectedCount = 25;44 $realCount = substr_count($content, 'dos'); 45 46 $this->assertEquals($expectedCount,$realCount);47 }48*/49 /**50 * @expectedException PHPUnit_Framework_Error51 * simplexml_load_file(): Entity: line 1: parser error : Detected an entity reference loop52 */53 public function testDOS_indirections() {54 $data = simplexml_load_file("../../xml_files_windows/dos/dos_indirections.xml",55 $class_name="SimpleXMLElement" 56 );57 58 /*$content = $data->__toString();59 $content = preg_replace('/\s+/', '', $content);60 $expectedCount = 25;61 $realCount = substr_count($content, 'dos');62 63 $this->assertEquals($expectedCount,$realCount);64 */65 }66 67 public function testDOS_indirections_LIBXML_PARSEHUGE() {68 $data = simplexml_load_file("../../xml_files_windows/dos/dos_indirections.xml",69 $class_name="SimpleXMLElement",70 $options=LIBXML_PARSEHUGE71 );72 73 $content = $data->__toString();74 $content = preg_replace('/\s+/', '', $content);75 $expectedCount = 10000;76 $realCount = substr_count($content, 'dos');77 78 $this->assertEquals($expectedCount,$realCount);79 }80 81 /**82 * @expectedException PHPUnit_Framework_Error83 parser error : PEReferences forbidden in internal subset84 */85 public function testDOS_indirections_parameterEntity() {86 $data = simplexml_load_file("../../xml_files_windows/dos/dos_indirections_parameterEntity.xml",87 $class_name="SimpleXMLElement" 88 );89 $content = $data->__toString();90 $content = preg_replace('/\s+/', '', $content);91 $expectedCount = 10000;92 $realCount = substr_count($content, 'dos');93 94 $this->assertEquals($expectedCount,$realCount);95 }96 97 98 public function testDOS_entitySize() {99 $data = simplexml_load_file("../../xml_files_windows/dos/dos_entitySize.xml",100 $class_name="SimpleXMLElement"101 );102 103 $content = $data->__toString();104 $content = preg_replace('/\s+/', '', $content);105 $expectedCount = 3400000;106 $realCount = substr_count($content, 'dos');107 108 $this->assertEquals($expectedCount,$realCount);109 }110 111/* 112 public function testDOS_entitySize_LIBXML_PARSEHUGE() {113 $data = simplexml_load_file("../../xml_files_windows/dos/dos_entitySize.xml",114 $class_name="SimpleXMLElement",115 $options=LIBXML_PARSEHUGE116 );117 118 $content = $data->__toString();119 $content = preg_replace('/\s+/', '', $content);120 $expectedCount = 3400000;121 $realCount = substr_count($content, 'dos');122 123 $this->assertEquals($expectedCount,$realCount);124 }125*/126 /**127 * @expectedException PHPUnit_Framework_Error128 simplexml_load_file(): Entity: line 1: parser error : Detected an entity reference loop129 **/130 public function testDOS_recursion() {131 $data = simplexml_load_file("../../xml_files_windows/dos/dos_recursion.xml",132 $class_name="SimpleXMLElement"133 );134 135 $content = $data->__toString();136 $content = preg_replace('/\s+/', '', $content);137 $expectedCount = 3400000;138 $realCount = substr_count($content, 'dos');139 140 $this->assertEquals($expectedCount,$realCount);141 }142 143 144 145 146 /**147 * @expectedException PHPUnit_Framework_Error148 * simplexml_load_file():149 * ../../xml_files_windows/dtd/externalParameterEntity/xxep/internalSubset_ExternalPEReferenceInDTD.xml:6:150 * parser error : Entity 'intern' not defined151 */152 public function testInternalSubset_ExternalPEReferenceInDTD() {153 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_ExternalPEReferenceInDTD.xml",154 $class_name="SimpleXMLElement"155 );156 }157 158 public function testInternalSubset_ExternalPEReferenceInDTD_LIBXML_DTDATTR() {159 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_ExternalPEReferenceInDTD.xml",160 $class_name="SimpleXMLElement",161 $options = LIBXML_DTDATTR162 );163 $content = $data->__toString();164 $content = preg_replace('/\s+/', '', $content);165 166 $this->assertEquals("data",$data->getName());167 $this->assertEquals("it_works",$content);168 }169 170 public function testInternalSubset_ExternalPEReferenceInDTD_LIBXML_DTDLOAD() {171 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_ExternalPEReferenceInDTD.xml",172 $class_name="SimpleXMLElement",173 $options = LIBXML_DTDLOAD174 );175 $content = $data->__toString();176 $content = preg_replace('/\s+/', '', $content);177 178 $this->assertEquals("data",$data->getName());179 $this->assertEquals("it_works",$content);180 }181 182 public function testInternalSubset_ExternalPEReferenceInDTD_LIBXML_DTDVALID() {183 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_ExternalPEReferenceInDTD.xml",184 $class_name="SimpleXMLElement",185 $options = LIBXML_DTDVALID186 );187 $content = $data->__toString();188 $content = preg_replace('/\s+/', '', $content);189 190 $this->assertEquals("data",$data->getName());191 $this->assertEquals("it_works",$content);192 }193 194 195 public function testInternalSubset_ExternalPEReferenceInDTD_LIBXML_NOENT() {196 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_ExternalPEReferenceInDTD.xml",197 $class_name="SimpleXMLElement",198 $options = LIBXML_NOENT199 );200 $content = $data->__toString();201 $content = preg_replace('/\s+/', '', $content);202 203 $this->assertEquals("data",$data->getName());204 $this->assertEquals("it_works",$content);205 }206 207 /*sinnlos208 public function testInternalSubset_ExternalPEReferenceInDTD_LIBXML_NOENT_disable_entity_loader () {209 210 libxml_disable_entity_loader(true);211 212 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_ExternalPEReferenceInDTD.xml",213 $class_name="SimpleXMLElement",214 $options = LIBXML_NOENT215 );216 217 218 $content = $data->__toString();219 $content = preg_replace('/\s+/', '', $content);220 221 $this->assertEquals("data",$data->getName());222 $this->assertEquals("it_works",$content);223 }224 */225 226 227 public function testInternalSubset_PEReferenceInDTD() {228 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_PEReferenceInDTD.xml",229 $class_name="SimpleXMLElement"230 );231 232 $content = $data->__toString();233 $content = preg_replace('/\s+/', '', $content);234 235 $this->assertEquals("data",$data->getName());236 $this->assertEquals("it_works",$content);237 }238 239 /* sinnlos240 public function testInternalSubset_PEReferenceInDTD_LIBXML_NOENT() {241 $data = simplexml_load_file("../../xml_files_windows/xxep/internalSubset_PEReferenceInDTD.xml",242 $class_name="SimpleXMLElement",243 $options=LIBXML_NOENT244 );245 246 $content = $data->__toString();247 $content = preg_replace('/\s+/', '', $content);248 249 $this->assertEquals("data",$data->getName());250 $this->assertEquals("it_works",$content);251 }252 */253 254 255 /**256 * @expectedException PHPUnit_Framework_Error257 simplexml_load_file(): ../../xml_files_windows/xxep/parameterEntity_core.xml:10: parser error : Entity 'all' not defined258 */259 public function testParameterEntity_core() {260 261 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",262 $class_name="SimpleXMLElement");263 264 $content = $data->__toString();265 $content = preg_replace('/\s+/', '', $content);266 267 $this->assertEquals("data",$data->getName());268 $this->assertEquals("",$content);269 }270 271 public function testParameterEntity_core_LIBXML_DTDATTR() {272 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",273 $class_name="SimpleXMLElement",274 $options=LIBXML_DTDATTR);275 276 $content = $data->__toString();277 $content = preg_replace('/\s+/', '', $content);278 279 $this->assertEquals("data",$data->getName());280 $this->assertEquals("it_works",$content);281 } 282 283 /**284 * @expectedException PHPUnit_Framework_Error285 parser error : Entity 'all' not defined286 */287 public function testParameterEntity_core_LIBXML_DTDATTR_NONET() {288 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",289 $class_name="SimpleXMLElement",290 $options=LIBXML_DTDATTR|LIBXML_NONET);291 /*292 $content = $data->__toString();293 $content = preg_replace('/\s+/', '', $content);294 295 $this->assertEquals("data",$data->getName());296 $this->assertEquals("it_works",$content);297 */298 }299 300 301 public function testParameterEntity_core_LIBXML_DTDLOAD() {302 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",303 $class_name="SimpleXMLElement",304 $options=LIBXML_DTDLOAD);305 306 $content = $data->__toString();307 $content = preg_replace('/\s+/', '', $content);308 309 $this->assertEquals("data",$data->getName());310 $this->assertEquals("it_works",$content);311 } 312 313 /**314 * @expectedException PHPUnit_Framework_Error315 simplexml_load_file(): Attempt to load network entity http://127.0.0.1:5000/parameterEntity_core.dtd../../xml_files_windows/xxep/parameterEntity_core.xml:10: parser error : Entity 'all' not defined316 */317 318 public function testParameterEntity_core_LIBXML_DTDLOAD_NONET() {319 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",320 $class_name="SimpleXMLElement",321 $options=LIBXML_DTDLOAD|LIBXML_NONET);322 /*323 $content = $data->__toString();324 $content = preg_replace('/\s+/', '', $content);325 326 $this->assertEquals("data",$data->getName());327 $this->assertEquals("it_works",$content);328 */329 } 330 331 332 public function testParameterEntity_core_LIBXML_DTDVALID() {333 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",334 $class_name="SimpleXMLElement",335 $options=LIBXML_DTDVALID);336 337 $content = $data->__toString();338 $content = preg_replace('/\s+/', '', $content);339 340 $this->assertEquals("data",$data->getName());341 $this->assertEquals("it_works",$content);342 }343 /**344 * @expectedException PHPUnit_Framework_Error345 simplexml_load_file(): Attempt to load network entity http://127.0.0.1:5000/parameterEntity_core.dtd../../xml_files_windows/xxep/parameterEntity_core.xml:10: parser error : Entity 'all' not defined346 */347 public function testParameterEntity_core_LIBXML_DTDVALID_NONET() {348 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",349 $class_name="SimpleXMLElement",350 $options=LIBXML_DTDVALID|LIBXML_NONET);351/* 352 $content = $data->__toString();353 $content = preg_replace('/\s+/', '', $content);354 355 $this->assertEquals("data",$data->getName());356 $this->assertEquals("it_works",$content);357 */358 }359 360 361 public function testParameterEntity_core_LIBXML_NOENT() {362 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",363 $class_name="SimpleXMLElement",364 $options=LIBXML_NOENT);365 366 $content = $data->__toString();367 $content = preg_replace('/\s+/', '', $content);368 369 $this->assertEquals("data",$data->getName());370 $this->assertEquals("it_works",$content);371 } 372 /**373 * @expectedException PHPUnit_Framework_Error374 * simplexml_load_file(): Attempt to load network entity 375 * http://127.0.0.1:5000/combine.dtd../../xml_files_windows/xxep/parameterEntity_core.xml:9: 376 * parser error : Entity 'all' not defined377 */ 378 public function testParameterEntity_core_LIBXML_NOENT_NONET() {379 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",380 $class_name="SimpleXMLElement",381 $options=LIBXML_NOENT|LIBXML_NONET);382 383 $content = $data->__toString();384 $content = preg_replace('/\s+/', '', $content);385 386 $this->assertEquals("data",$data->getName());387 $this->assertEquals("it_works",$content);388 } 389 390 391 /*sinnlos392 public function testParameterEntity_LIBXML_NOENT_disable_entity_loader() {393 libxml_disable_entity_loader(true);394 395 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_core.xml",396 $class_name="SimpleXMLElement",397 $options=LIBXML_NOENT);398 399// $content = $data->__toString();400// $content = preg_replace('/\s+/', '', $content);401 402// $this->assertEquals("data",$data->getName());403// $this->assertEquals("it_works",$content);404 } 405 */406 407 408 409 410 /**411 * @expectedException PHPUnit_Framework_Error 412 * simplexml_load_file(): ../../xml_files_windows/xxep/parameterEntity_doctype.xml:3: parser error : Entity 'all' not defined 413 */414 415 public function testParameterEntity_doctype() {416 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",417 $class_name="SimpleXMLElement");418 419 $content = $data->__toString();420 $content = preg_replace('/\s+/', '', $content);421 422 $this->assertEquals("data",$data->getName());423 $this->assertEquals("",$content);424 }425 426 427 public function testParameterEntity_doctype_LIBXML_DTDATTR() {428 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",429 $class_name="SimpleXMLElement",430 $options=LIBXML_DTDATTR431 );432 433 $content = $data->__toString();434 $content = preg_replace('/\s+/', '', $content);435 436 $this->assertEquals("data",$data->getName());437 $this->assertEquals("it_works",$content);438 }439 440 /**441 * @expectedException PHPUnit_Framework_Error 442 parser error : Entity 'all' not defined443 */444 public function testParameterEntity_doctype_LIBXML_DTDATTR_NONET() {445 446 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",447 $class_name="SimpleXMLElement",448 $options=LIBXML_DTDATTR|LIBXML_NONET449 );450 }451 public function testParameterEntity_doctype_LIBXML_DTDLOAD() {452 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",453 $class_name="SimpleXMLElement",454 $options=LIBXML_DTDLOAD455 );456 457 $content = $data->__toString();458 $content = preg_replace('/\s+/', '', $content);459 460 $this->assertEquals("data",$data->getName());461 $this->assertEquals("it_works",$content);462 }463 464 /**465 * @expectedException PHPUnit_Framework_Error 466 * simplexml_load_file(): Attempt to load network entity http://127.0.0.1:5000/parameterEntity_doctype.dtd../../xml_files_windows/xxep/parameterEntity_doctype.xml:3: parser error : Entity 'all' not defined467 */468 public function testParameterEntity_doctype_LIBXML_DTDLOAD_NONET() {469 470 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",471 $class_name="SimpleXMLElement",472 $options=LIBXML_DTDLOAD|LIBXML_NONET473 );474 /*475 $content = $data->__toString();476 $content = preg_replace('/\s+/', '', $content);477 478 $this->assertEquals("data",$data->getName());479 $this->assertEquals("it_works",$content);480 */481 }482 483 public function testParameterEntity_doctype_LIBXML_DTDVALID() {484 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",485 $class_name="SimpleXMLElement",486 $options=LIBXML_DTDVALID487 );488 489 $content = $data->__toString();490 $content = preg_replace('/\s+/', '', $content);491 492 $this->assertEquals("data",$data->getName());493 $this->assertEquals("it_works",$content);494 }495 /**496 * @expectedException PHPUnit_Framework_Error 497 simplexml_load_file(): Attempt to load network entity http://127.0.0.1:5000/parameterEntity_doctype.dtd../../xml_files_windows/xxep/parameterEntity_doctype.xml:3: validity error : Validation failed: no DTD found !498 */499 public function testParameterEntity_doctype_LIBXML_DTDVALID_NONET() {500 501 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",502 $class_name="SimpleXMLElement",503 $options=LIBXML_DTDVALID|LIBXML_NONET504 );505 506 $content = $data->__toString();507 $content = preg_replace('/\s+/', '', $content);508 509 $this->assertEquals("data",$data->getName());510 $this->assertEquals("it_works",$content);511 512 }513 514 /**515 * @expectedException PHPUnit_Framework_Error 516 * simplexml_load_file(): ../../xml_files_windows/xxep/parameterEntity_doctype.xml:3: parser 517 * error : Entity 'all' not defined518 */519 public function testParameterEntity_doctype_LIBXML_NOENT() {520 $data = simplexml_load_file("../../xml_files_windows/xxep/parameterEntity_doctype.xml",521 $class_name="SimpleXMLElement",522 $options=LIBXML_NOENT 523 );524 525 }526 527 528 public function testURLInvocation_doctype() {529 530 // reset the counter531 $r = file_get_contents("http://127.0.0.1:5000/reset");532 $r = file_get_contents("http://127.0.0.1:5000/getCounter");533 $r = preg_replace('/\s+/', '', $r);534 $this->assertEquals("0", $r);535 536 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",537 $class_name="SimpleXMLElement"538 );539 540 $r = file_get_contents("http://127.0.0.1:5000/getCounter");541 $r = preg_replace('/\s+/', '', $r);542 $this->assertEquals("0", $r); 543 }544 545 546 public function testURLInvocation_doctype_LIBXML_DTDATTR() {547 // reset the counter548 $r = file_get_contents("http://127.0.0.1:5000/reset");549 $r = file_get_contents("http://127.0.0.1:5000/getCounter");550 $r = preg_replace('/\s+/', '', $r);551 $this->assertEquals("0", $r);552 553 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",554 $class_name="SimpleXMLElement",555 $options=LIBXML_DTDATTR556 );557 558 $r = file_get_contents("http://127.0.0.1:5000/getCounter");559 $r = preg_replace('/\s+/', '', $r);560 $this->assertEquals("1", $r);561 562 }563 564 public function testURLInvocation_doctype_LIBXML_DTDATTR_NONET() {565 //setting LIBXML_NONET566 $r = file_get_contents("http://127.0.0.1:5000/reset");567 $r = file_get_contents("http://127.0.0.1:5000/getCounter");568 $r = preg_replace('/\s+/', '', $r);569 $this->assertEquals("0", $r);570 571 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",572 $class_name="SimpleXMLElement",573 $options=LIBXML_DTDATTR|LIBXML_NONET574 );575 576 $r = file_get_contents("http://127.0.0.1:5000/getCounter");577 $r = preg_replace('/\s+/', '', $r);578 $this->assertEquals("0", $r);579 }580 581 582 public function testURLInvocation_doctype_LIBXML_DTDLOAD() {583 // reset the counter584 $r = file_get_contents("http://127.0.0.1:5000/reset");585 $r = file_get_contents("http://127.0.0.1:5000/getCounter");586 $r = preg_replace('/\s+/', '', $r);587 $this->assertEquals("0", $r);588 589 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",590 $class_name="SimpleXMLElement",591 $options=LIBXML_DTDLOAD592 );593 594 $r = file_get_contents("http://127.0.0.1:5000/getCounter");595 $r = preg_replace('/\s+/', '', $r);596 $this->assertEquals("1", $r);597 598 } 599 600 public function testURLInvocation_doctype_LIBXML_DTDLOAD_NONET() {601 //setting LIBXML_NONET602 $r = file_get_contents("http://127.0.0.1:5000/reset");603 $r = file_get_contents("http://127.0.0.1:5000/getCounter");604 $r = preg_replace('/\s+/', '', $r);605 $this->assertEquals("0", $r);606 607 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",608 $class_name="SimpleXMLElement",609 $options=LIBXML_DTDLOAD|LIBXML_NONET610 );611 612 $r = file_get_contents("http://127.0.0.1:5000/getCounter");613 $r = preg_replace('/\s+/', '', $r);614 $this->assertEquals("0", $r);615 }616 617 618 public function testURLInvocation_doctype_LIBXML_DTDVALID() {619 // reset the counter620 $r = file_get_contents("http://127.0.0.1:5000/reset");621 $r = file_get_contents("http://127.0.0.1:5000/getCounter");622 $r = preg_replace('/\s+/', '', $r);623 $this->assertEquals("0", $r);624 625 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",626 $class_name="SimpleXMLElement",627 $options=LIBXML_DTDVALID628 );629 630 $r = file_get_contents("http://127.0.0.1:5000/getCounter");631 $r = preg_replace('/\s+/', '', $r);632 $this->assertEquals("1", $r);633 634 }635 636 public function testURLInvocation_doctype_LIBXML_DTDVALID_NONET() {637 //setting LIBXML_NONET638 $r = file_get_contents("http://127.0.0.1:5000/reset");639 $r = file_get_contents("http://127.0.0.1:5000/getCounter");640 $r = preg_replace('/\s+/', '', $r);641 $this->assertEquals("0", $r);642 643 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",644 $class_name="SimpleXMLElement",645 $options=LIBXML_DTDVALID|LIBXML_NONET646 );647 648 $r = file_get_contents("http://127.0.0.1:5000/getCounter");649 $r = preg_replace('/\s+/', '', $r);650 $this->assertEquals("0", $r);651 } 652 653 public function testURLInvocation_doctype_LIBXML_NOENT() {654 // reset the counter655 $r = file_get_contents("http://127.0.0.1:5000/reset");656 $r = file_get_contents("http://127.0.0.1:5000/getCounter");657 $r = preg_replace('/\s+/', '', $r);658 $this->assertEquals("0", $r);659 660 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",661 $class_name="SimpleXMLElement",662 $options=LIBXML_NOENT663 );664 665 $r = file_get_contents("http://127.0.0.1:5000/getCounter");666 $r = preg_replace('/\s+/', '', $r);667 $this->assertEquals("0", $r);668 669 }670 671 672 673 public function testURLInvocation_externalGeneralEntity(){674 // reset the counter675 $r = file_get_contents("http://127.0.0.1:5000/reset");676 $r = file_get_contents("http://127.0.0.1:5000/getCounter");677 $r = preg_replace('/\s+/', '', $r);678 $this->assertEquals("0", $r);679 680 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",681 $class_name="SimpleXMLElement"682 );683 684 $r = file_get_contents("http://127.0.0.1:5000/getCounter");685 $r = preg_replace('/\s+/', '', $r);686 $this->assertEquals("0", $r);687 688 }689 690 public function testURLInvocation_externalGeneralEntity_LIBXML_DTDATTR() {691 692 693 // reset the counter694 $r = file_get_contents("http://127.0.0.1:5000/reset");695 $r = file_get_contents("http://127.0.0.1:5000/getCounter");696 $r = preg_replace('/\s+/', '', $r);697 $this->assertEquals("0", $r);698 699 700 // enable entities701 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",702 $class_name="SimpleXMLElement",703 $options =LIBXML_DTDATTR704 );705 706 $r = file_get_contents("http://127.0.0.1:5000/getCounter");707 $r = preg_replace('/\s+/', '', $r);708 $this->assertEquals("0", $r);709 }710 711 712 public function testURLInvocation_externalGeneralEntity_LIBXML_DTDLOAD() {713 714 715 // reset the counter716 $r = file_get_contents("http://127.0.0.1:5000/reset");717 $r = file_get_contents("http://127.0.0.1:5000/getCounter");718 $r = preg_replace('/\s+/', '', $r);719 $this->assertEquals("0", $r);720 721 722 // enable entities723 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",724 $class_name="SimpleXMLElement",725 $options =LIBXML_DTDLOAD726 );727 728 $r = file_get_contents("http://127.0.0.1:5000/getCounter");729 $r = preg_replace('/\s+/', '', $r);730 $this->assertEquals("0", $r);731 }732 733 734 public function testURLInvocation_externalGeneralEntity_LIBXML_DTDVALID() {735 736 737 // reset the counter738 $r = file_get_contents("http://127.0.0.1:5000/reset");739 $r = file_get_contents("http://127.0.0.1:5000/getCounter");740 $r = preg_replace('/\s+/', '', $r);741 $this->assertEquals("0", $r);742 743 744 // enable entities745 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",746 $class_name="SimpleXMLElement",747 $options =LIBXML_DTDVALID748 );749 750 $r = file_get_contents("http://127.0.0.1:5000/getCounter");751 $r = preg_replace('/\s+/', '', $r);752 $this->assertEquals("1", $r);753 }754 755 756 /**757 * @expectedException PHPUnit_Framework_Error758 simplexml_load_file(): Attempt to load network entity http://127.0.0.1:5000/Attempt to load network entity http://127.0.0.1:5000/Attempt to load network entity http://127.0.0.1:5000/file.xml../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml:6: parser error : Failure to process entity remote759 */760 public function testURLInvocation_externalGeneralEntity_LIBXML_DTDVALID_NONET() {761 //setting LIBXML_NONET762 $r = file_get_contents("http://127.0.0.1:5000/reset");763 $r = file_get_contents("http://127.0.0.1:5000/getCounter");764 $r = preg_replace('/\s+/', '', $r);765 $this->assertEquals("0", $r);766 767 768 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",769 $class_name="SimpleXMLElement",770 $options=LIBXML_DTDVALID|LIBXML_NONET771 );772 773 $r = file_get_contents("http://127.0.0.1:5000/getCounter");774 $r = preg_replace('/\s+/', '', $r);775 $this->assertEquals("0", $r);776 } 777 778 779 780 public function testURLInvocation_externalGeneralEntity_LIBXML_NOENT() {781 782 783 // reset the counter784 $r = file_get_contents("http://127.0.0.1:5000/reset");785 $r = file_get_contents("http://127.0.0.1:5000/getCounter");786 $r = preg_replace('/\s+/', '', $r);787 $this->assertEquals("0", $r);788 789 790 // enable entities791 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",792 $class_name="SimpleXMLElement",793 $options =LIBXML_NOENT794 );795 796 $r = file_get_contents("http://127.0.0.1:5000/getCounter");797 $r = preg_replace('/\s+/', '', $r);798 $this->assertEquals("1", $r);799 }800 801 802 /*sinnlos803 public function testURLInvocation_externalGeneralEntity_LIBXML_NOENT_disable_entity_loader() {804 805 806 // reset the counter807 $r = file_get_contents("http://127.0.0.1:5000/reset");808 $r = file_get_contents("http://127.0.0.1:5000/getCounter");809 $r = preg_replace('/\s+/', '', $r);810 $this->assertEquals("0", $r);811 812 813 libxml_disable_entity_loader(true);814 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",815 $class_name="SimpleXMLElement",816 $options =LIBXML_NOENT817 );818 819 $r = file_get_contents("http://127.0.0.1:5000/getCounter");820 $r = preg_replace('/\s+/', '', $r);821 $this->assertEquals("1", $r);822 }823 */824 /**825 * @expectedException PHPUnit_Framework_Error826 * simplexml_load_file(): Attempt to load network entity http://127.0.0.1:5000/test.xml../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml:5: parser error : Failure to process entity remote827 */828 public function testURLInvocation_externalGeneralEntity_LIBXML_NOENT_NONET() {829 //setting LIBXML_NONET830 $r = file_get_contents("http://127.0.0.1:5000/reset");831 $r = file_get_contents("http://127.0.0.1:5000/getCounter");832 $r = preg_replace('/\s+/', '', $r);833 $this->assertEquals("0", $r);834 835 836 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_externalGeneralEntity.xml",837 $class_name="SimpleXMLElement",838 $options=LIBXML_NOENT|LIBXML_NONET839 );840 841 $r = file_get_contents("http://127.0.0.1:5000/getCounter");842 $r = preg_replace('/\s+/', '', $r);843 $this->assertEquals("0", $r);844 }845 846 847 848 public function testURLInvocation_parameterEntity() {849 850 // reset the counter851 $r = file_get_contents("http://127.0.0.1:5000/reset");852 $r = file_get_contents("http://127.0.0.1:5000/getCounter");853 $r = preg_replace('/\s+/', '', $r);854 $this->assertEquals("0", $r);855 856 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",857 $class_name="SimpleXMLElement"858 );859 860 $r = file_get_contents("http://127.0.0.1:5000/getCounter");861 $r = preg_replace('/\s+/', '', $r);862 $this->assertEquals("0", $r);863 }864 865 public function testURLInvocation_parameterEntity_LIBXML_DTDATTR() {866 867 868 // reset the counter869 $r = file_get_contents("http://127.0.0.1:5000/reset");870 $r = file_get_contents("http://127.0.0.1:5000/getCounter");871 $r = preg_replace('/\s+/', '', $r);872 $this->assertEquals("0", $r);873 874 // enable entities875 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",876 $class_name="SimpleXMLElement",877 $options =LIBXML_DTDATTR878 );879 880 $r = file_get_contents("http://127.0.0.1:5000/getCounter");881 $r = preg_replace('/\s+/', '', $r);882 $this->assertEquals("1", $r);883 }884 885 public function testURLInvocation_parameterEntity_LIBXML_DTDATTR_NONET() {886 //setting LIBXML_NONET887 $r = file_get_contents("http://127.0.0.1:5000/reset");888 $r = file_get_contents("http://127.0.0.1:5000/getCounter");889 $r = preg_replace('/\s+/', '', $r);890 $this->assertEquals("0", $r);891 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",892 $class_name="SimpleXMLElement",893 $options=LIBXML_DTDATTR|LIBXML_NONET894 );895 896 $r = file_get_contents("http://127.0.0.1:5000/getCounter");897 $r = preg_replace('/\s+/', '', $r);898 $this->assertEquals("0", $r);899 }900 901 902 903 904 905 public function testURLInvocation_parameterEntity_LIBXML_DTDLOAD() {906 907 908 // reset the counter909 $r = file_get_contents("http://127.0.0.1:5000/reset");910 $r = file_get_contents("http://127.0.0.1:5000/getCounter");911 $r = preg_replace('/\s+/', '', $r);912 $this->assertEquals("0", $r);913 914 // enable entities915 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",916 $class_name="SimpleXMLElement",917 $options =LIBXML_DTDLOAD918 );919 920 $r = file_get_contents("http://127.0.0.1:5000/getCounter");921 $r = preg_replace('/\s+/', '', $r);922 $this->assertEquals("1", $r);923 }924 925 public function testURLInvocation_parameterEntity_LIBXML_DTDLOAD_NONET() {926 //setting LIBXML_NONET927 $r = file_get_contents("http://127.0.0.1:5000/reset");928 $r = file_get_contents("http://127.0.0.1:5000/getCounter");929 $r = preg_replace('/\s+/', '', $r);930 $this->assertEquals("0", $r);931 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",932 $class_name="SimpleXMLElement",933 $options=LIBXML_DTDLOAD|LIBXML_NONET934 );935 936 $r = file_get_contents("http://127.0.0.1:5000/getCounter");937 $r = preg_replace('/\s+/', '', $r);938 $this->assertEquals("0", $r);939 }940 941 942 public function testURLInvocation_parameterEntity_LIBXML_DTDVALID() {943 944 945 // reset the counter946 $r = file_get_contents("http://127.0.0.1:5000/reset");947 $r = file_get_contents("http://127.0.0.1:5000/getCounter");948 $r = preg_replace('/\s+/', '', $r);949 $this->assertEquals("0", $r);950 951 // enable entities952 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",953 $class_name="SimpleXMLElement",954 $options =LIBXML_DTDVALID955 );956 957 $r = file_get_contents("http://127.0.0.1:5000/getCounter");958 $r = preg_replace('/\s+/', '', $r);959 $this->assertEquals("1", $r);960 }961 962 public function testURLInvocation_parameterEntity_LIBXML_DTDVALID_NONET() {963 //setting LIBXML_NONET964 $r = file_get_contents("http://127.0.0.1:5000/reset");965 $r = file_get_contents("http://127.0.0.1:5000/getCounter");966 $r = preg_replace('/\s+/', '', $r);967 $this->assertEquals("0", $r);968 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",969 $class_name="SimpleXMLElement",970 $options=LIBXML_DTDVALID|LIBXML_NONET971 );972 973 $r = file_get_contents("http://127.0.0.1:5000/getCounter");974 $r = preg_replace('/\s+/', '', $r);975 $this->assertEquals("0", $r);976 }977 978 public function testURLInvocation_parameterEntity_LIBXML_NOENT() {979 980 981 // reset the counter982 $r = file_get_contents("http://127.0.0.1:5000/reset");983 $r = file_get_contents("http://127.0.0.1:5000/getCounter");984 $r = preg_replace('/\s+/', '', $r);985 $this->assertEquals("0", $r);986 987 // enable entities988 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",989 $class_name="SimpleXMLElement",990 $options =LIBXML_NOENT991 );992 993 $r = file_get_contents("http://127.0.0.1:5000/getCounter");994 $r = preg_replace('/\s+/', '', $r);995 $this->assertEquals("1", $r);996 }997 998 999 /*sinnlos1000 public function testURLInvocation_parameterEntity_LIBXML_NOENT_disable_entity_loader() {1001 1002 1003 // reset the counter1004 $r = file_get_contents("http://127.0.0.1:5000/reset");1005 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1006 $r = preg_replace('/\s+/', '', $r);1007 $this->assertEquals("0", $r);1008 1009 1010 libxml_disable_entity_loader(true);1011 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",1012 $class_name="SimpleXMLElement",1013 $options =LIBXML_NOENT1014 );1015 1016 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1017 $r = preg_replace('/\s+/', '', $r);1018 $this->assertEquals("1", $r);1019 }1020 */1021 1022 public function testURLInvocation_parameterEntity_LIBXML_NOENT_NONET() {1023 //setting LIBXML_NONET1024 $r = file_get_contents("http://127.0.0.1:5000/reset");1025 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1026 $r = preg_replace('/\s+/', '', $r);1027 $this->assertEquals("0", $r);1028 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_parameterEntity.xml",1029 $class_name="SimpleXMLElement",1030 $options=LIBXML_NOENT|LIBXML_NONET1031 );1032 1033 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1034 $r = preg_replace('/\s+/', '', $r);1035 $this->assertEquals("0", $r);1036 }1037 1038 public function testURLInvocation_schemaLocation(){1039 1040 // reset the counter1041 $r = file_get_contents("http://127.0.0.1:5000/reset");1042 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1043 $r = preg_replace('/\s+/', '', $r);1044 $this->assertEquals("0", $r);1045 1046 1047 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_schemaLocation.xml",1048 $class_name="SimpleXMLElement"1049 );1050 1051 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1052 $r = preg_replace('/\s+/', '', $r);1053 $this->assertEquals("0", $r);1054 1055 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_noNamespaceSchemaLocation.xml",1056 $class_name="SimpleXMLElement" 1057 );1058 1059 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1060 $r = preg_replace('/\s+/', '', $r);1061 $this->assertEquals("0", $r);1062 1063 }1064 1065 1066 1067 public function testURLInvocation_XInclude() {1068 // reset the counter1069 $r = file_get_contents("http://127.0.0.1:5000/reset");1070 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1071 $r = preg_replace('/\s+/', '', $r);1072 $this->assertEquals("0", $r); 1073 1074 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_xinclude.xml",1075 $class_name="SimpleXMLElement"1076 );1077 1078 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1079 $r = preg_replace('/\s+/', '', $r);1080 $this->assertEquals("0", $r);1081 1082 }1083 1084 public function testURLInvocation_XInclude_LIBXML_XINCLUDE() {1085 // reset the counter1086 $r = file_get_contents("http://127.0.0.1:5000/reset");1087 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1088 $r = preg_replace('/\s+/', '', $r);1089 $this->assertEquals("0", $r);1090 1091 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_xinclude.xml",1092 $class_name="SimpleXMLElement",1093 $options=LIBXML_XINCLUDE1094 );1095 1096 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1097 $r = preg_replace('/\s+/', '', $r);1098 $this->assertEquals("0", $r);1099 }1100 1101 /*1102 public function testURLInvocation_XInclude_LIBXML_XINCLUDE_NONET() {1103 // reset the counter1104 $r = file_get_contents("http://127.0.0.1:5000/reset");1105 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1106 $r = preg_replace('/\s+/', '', $r);1107 $this->assertEquals("0", $r);1108 1109 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_xinclude.xml",1110 $class_name="SimpleXMLElement",1111 $options=LIBXML_XINCLUDE|LIBXML_NONET 1112 );1113 1114 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1115 $r = preg_replace('/\s+/', '', $r);1116 $this->assertEquals("0", $r);1117 }1118 */1119 1120 public function testURLInvocation_noNamespaceSchemaLocation(){1121 1122 // reset the counter1123 $r = file_get_contents("http://127.0.0.1:5000/reset");1124 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1125 $r = preg_replace('/\s+/', '', $r);1126 $this->assertEquals("0", $r);1127 1128 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_noNamespaceSchemaLocation.xml",1129 $class_name="SimpleXMLElement"1130 );1131 1132 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1133 $r = preg_replace('/\s+/', '', $r);1134 $this->assertEquals("0", $r);1135 1136 $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_noNamespaceSchemaLocation.xml",1137 $class_name="SimpleXMLElement"1138 );1139 1140 $r = file_get_contents("http://127.0.0.1:5000/getCounter");1141 $r = preg_replace('/\s+/', '', $r);1142 $this->assertEquals("0", $r);1143 1144 }1145 1146 1147 public function testXInclude() {1148 $data = simplexml_load_file("../../xml_files_windows/xinclude.xml",1149 $class_name="SimpleXMLElement"1150 );1151 //$content = $data->__toString();1152 //$name = $data->getName();1153 //get all children with namespace prefix xi1154 $child_nodes = $data->children("xi", True);1155 $content = $child_nodes->asXML();1156 //$content = $data->asXML(); 1157 //$content = preg_replace('/\s+/', '', $content); 1158 1159 $this->assertEquals('<xi:include href="C:/Christopher_Spaeth/code/xml_files_windows/xinclude_source.xml"/>',$content);1160 1161 }1162 1163 public function testXInclude_LIBXML_XINCLUDE() {1164 $data = simplexml_load_file("../../xml_files_windows/xinclude.xml",1165 $class_name="SimpleXMLElement",1166 $options=LIBXML_XINCLUDE);1167 1168 $content = $data->__toString(); 1169 $content = preg_replace('/\s+/', '', $content);1170 1171 $child_nodes = $data->children("xi", True);1172 $content = $child_nodes->asXML();1173 $this->assertEquals('<xi:include href="C:/Christopher_Spaeth/code/xml_files_windows/xinclude_source.xml"/>',$content);1174 1175 }1176 1177 public function testXSLT() {1178 $data = simplexml_load_file("../../xml_files_windows/optional/xslt.xsl",1179 $class_name="SimpleXMLElement");1180 1181 $this->assertEquals("stylesheet", $data->getName());1182 1183 }1184 1185 1186 public function testXXE() {1187 $data = simplexml_load_file("../../xml_files_windows/xxe/xxe.xml",1188 $class_name="SimpleXMLElement");1189 1190 $content = $data->__toString();1191 $content = preg_replace('/\s+/', '', $content);1192 1193 $this->assertEquals("data",$data->getName());1194 $this->assertEquals("",$content);1195 }1196 1197 public function testXXE_LIBXML_DTDATTR() {1198 $data = simplexml_load_file("../../xml_files_windows/xxe/xxe.xml",1199 $class_name="SimpleXMLElement",1200 $options=LIBXML_DTDATTR);1201 1202 $content = $data->__toString();1203 $content = preg_replace('/\s+/', '', $content);1204 $this->assertEquals('',$content);1205 }1206 1207 public function testXXE_LIBXML_DTDLOAD() {1208 $data = simplexml_load_file("../../xml_files_windows/xxe/xxe.xml",1209 $class_name="SimpleXMLElement",1210 $options=LIBXML_DTDLOAD);1211 1212 $content = $data->__toString();1213 $content = preg_replace('/\s+/', '', $content);1214 $this->assertEquals('',$content);1215 }1216 1217 public function testXXE_LIBXML_DTDVALID() {1218 $data = simplexml_load_file("../../xml_files_windows/xxe/xxe.xml",1219 $class_name="SimpleXMLElement",1220 $options=LIBXML_DTDVALID);1221 1222 $content = $data->__toString();1223 $content = preg_replace('/\s+/', '', $content);1224 $this->assertEquals('it_works',$content);1225 }1226 1227 public function testXXE_LIBXML_NOENT() {1228 $data = simplexml_load_file("../../xml_files_windows/xxe/xxe.xml",1229 $class_name="SimpleXMLElement",1230 $options=LIBXML_NOENT);1231 1232 $content = $data->__toString();1233 $content = preg_replace('/\s+/', '', $content);1234 $this->assertEquals('it_works',$content);1235 }1236 1237 1238 /**1239 * @expectedException PHPUnit_Framework_Error1240 simplexml_load_file(): Attempt to load network entity http://127.0.0.1:5000/url_invocation_parameterEntity.dtdI/O warning : failed to load external entity "../../xml_files_windows/xxe/xxe.xml"1241 */1242 public function testXXE_LIBXML_NOENT_disable_entity_loader() {1243 1244 1245 libxml_disable_entity_loader(true);1246 1247 $data = simplexml_load_file("../../xml_files_windows/xxe/xxe.xml",1248 $class_name="SimpleXMLElement",1249 $options=LIBXML_NOENT);1250 1251 $content = $data->__toString();1252 $content = preg_replace('/\s+/', '', $content);1253 1254 $this->assertEquals("data",$data->getName());1255 $this->assertEquals('',$content);1256 1257 }1258 1259 1260 1261// //http://php.net/manual/en/function.simplexml-load-string.php1262// // If you want to use multiple libxml options, separate them with a pipe, like so:1263// public function testUrlInvocation_setFeature_load_external_dtd() {1264 1265// $data = simplexml_load_file("../../xml_files_windows/ssrf/url_invocation_doctype.xml",1266// $class_name="SimpleXMLElement",1267// $options=LIBXML_DTDLOAD| LIBXML_NOENT1268// );1269 1270// // $content = $data->__toString();1271// // $content = preg_replace('/\s+/', '', $content);1272 1273// // $this->assertEquals("data",$data->getName());1274// // $this->assertEquals("",$content);1275// }1276 1277}1278?>...

Full Screen

Full Screen

utilities.php

Source:utilities.php Github

copy

Full Screen

...91 if ($child->getName() == 'objectProperties') {92 $properties = $child->children('foxml', TRUE);93 foreach ($properties as $property) {94 $property_attributes = $property->attributes();95 if ($property_attributes['NAME']->__toString() == 'info:fedora/fedora-system:def/model#label') {96 $data['label'] = $property_attributes['VALUE']->__toString();97 }98 }99 } 100 elseif ($child->getName() == 'datastream') {101 $child_attributes = $child->attributes();102 if ($child_attributes['ID']->__toString() == 'RELS-EXT') {103 $rels_ext = $child->datastreamVersion->xmlContent->children('rdf', TRUE)->RDF->Description;104 if (isset($rels_ext->children('fedora', TRUE)->isMemberOf)) {105 $data['parent'] = uri_prefix_strip($rels_ext->children('fedora', TRUE)->isMemberOf->attributes('rdf', TRUE)->resource->__toString());106 }107 $data['cmodel'] = uri_prefix_strip($rels_ext->children('info:fedora/fedora-system:def/model#')->hasModel->attributes('rdf', TRUE)->resource->__toString());108 }109 else if ($child_attributes['CONTROL_GROUP']->__toString() == 'M') {110 $datastream_versions = $child->children('foxml', TRUE);111 foreach ($datastream_versions as $datastream_version) {112 $content_location_attributes = $datastream_version->contentLocation->attributes();113 $data['datastreams'][] = $content_location_attributes['REF']->__toString();114 }115 }116 }117 }118 $data['pid'] = $object['PID']->__toString();119 return $data;120}121function copy_object($object_uri_path, $output_directory) {122 $exploded_path = explode('/', $object_uri_path);123 $parent_directory = $exploded_path[3];124 $object_uri = $exploded_path[4];125 $object_copy_path = "{$output_directory}/objectStore/{$parent_directory}/";126 shell_exec("mkdir -p {$object_copy_path}");127 shell_exec("cp {$object_uri_path} {$object_copy_path}/{$object_uri}");128 logmsg("Object {$object_uri} copied from {$object_uri_path} to {$object_copy_path}/{$object_uri}", $output_directory);129}130function copy_datastream($datastream_uri_path, $output_directory) {131 $exploded_path = explode('/', $datastream_uri_path);132 $parent_directories = "{$exploded_path[4]}/{$exploded_path[5]}/{$exploded_path[6]}";...

Full Screen

Full Screen

SubsetTest.php

Source:SubsetTest.php Github

copy

Full Screen

...70 $actual = $this->subset->match($actual);71 $expected = null; // TODO: Expected value here72 $this->assertEquals($expected, $actual);73}74public function test__toString0()75{76 // TODO: Your mock expectations here77 $actual = $this->subset->__toString();78 $expected = null; // TODO: Expected value here79 $this->assertEquals($expected, $actual);80}81public function test__toString1()82{83 // TODO: Your mock expectations here84 $actual = $this->subset->__toString();85 $expected = null; // TODO: Expected value here86 $this->assertEquals($expected, $actual);87}88}...

Full Screen

Full Screen

__toString

Using AI Code Generation

copy

Full Screen

1$obj = new Subset();2echo $obj;3$obj = new Subset();4echo $obj;5$obj = new Subset();6echo $obj;7$obj = new Subset();8echo $obj;9$obj = new Subset();10echo $obj;11$obj = new Subset();12echo $obj;13$obj = new Subset();14echo $obj;15$obj = new Subset();16echo $obj;17$obj = new Subset();18echo $obj;19$obj = new Subset();20echo $obj;21$obj = new Subset();22echo $obj;23$obj = new Subset();24echo $obj;25$obj = new Subset();26echo $obj;27$obj = new Subset();28echo $obj;29$obj = new Subset();30echo $obj;31$obj = new Subset();32echo $obj;33$obj = new Subset();34echo $obj;35$obj = new Subset();36echo $obj;37$obj = new Subset();38echo $obj;

Full Screen

Full Screen

__toString

Using AI Code Generation

copy

Full Screen

1$subset = new Subset(2, 3);2echo $subset;3$subset = new Subset(2, 3);4echo $subset;5$subset = new Subset(2, 3);6echo $subset;7$subset = new Subset(2, 3);8echo $subset;9$subset = new Subset(2, 3);10echo $subset;11$subset = new Subset(2, 3);12echo $subset;13$subset = new Subset(2, 3);14echo $subset;15$subset = new Subset(2, 3);16echo $subset;17$subset = new Subset(2, 3);18echo $subset;19$subset = new Subset(2, 3);20echo $subset;21$subset = new Subset(2, 3);22echo $subset;23$subset = new Subset(2, 3);24echo $subset;25$subset = new Subset(2, 3);26echo $subset;27$subset = new Subset(2, 3);28echo $subset;29$subset = new Subset(2, 3);30echo $subset;

Full Screen

Full Screen

__toString

Using AI Code Generation

copy

Full Screen

1$objSubset = new Subset();2$objSubset->setStart(1);3$objSubset->setEnd(10);4$objSubset->setStep(2);5echo $objSubset;6$objSubset = new Subset();7$objSubset->setStart(1);8$objSubset->setEnd(10);9$objSubset->setStep(2);10echo $objSubset;11$objSubset = new Subset();12$objSubset->setStart(1);13$objSubset->setEnd(10);14$objSubset->setStep(2);15echo $objSubset;16$objSubset = new Subset();17$objSubset->setStart(1);18$objSubset->setEnd(10);19$objSubset->setStep(2);20echo $objSubset;21$objSubset = new Subset();22$objSubset->setStart(1);23$objSubset->setEnd(10);24$objSubset->setStep(2);25echo $objSubset;26$objSubset = new Subset();27$objSubset->setStart(1);28$objSubset->setEnd(10);29$objSubset->setStep(2);30echo $objSubset;31$objSubset = new Subset();32$objSubset->setStart(1);33$objSubset->setEnd(10);34$objSubset->setStep(2);35echo $objSubset;36$objSubset = new Subset();37$objSubset->setStart(1);38$objSubset->setEnd(10);39$objSubset->setStep(2);40echo $objSubset;41$objSubset = new Subset();42$objSubset->setStart(1);43$objSubset->setEnd(10);44$objSubset->setStep(2);45echo $objSubset;46$objSubset = new Subset();47$objSubset->setStart(1);48$objSubset->setEnd(10

Full Screen

Full Screen

__toString

Using AI Code Generation

copy

Full Screen

1$subset = new Subset("A", "B", "C", "D", "E", "F", "G");2echo $subset;3$subset = new Subset("A", "B", "C", "D", "E", "F", "G");4echo $subset;5$subset = new Subset("A", "B", "C", "D", "E", "F", "G");6echo $subset;7$subset = new Subset("A", "B", "C", "D", "E", "F", "G");8echo $subset;9$subset = new Subset("A", "B", "C", "D", "E", "F", "G");10echo $subset;11$subset = new Subset("A", "B", "C", "D", "E", "F", "G");12echo $subset;13$subset = new Subset("A", "B", "C", "D", "E", "F", "G");14echo $subset;15$subset = new Subset("A", "B", "C", "D", "E", "F", "G");16echo $subset;17$subset = new Subset("A", "B", "C", "D", "E", "F", "G");18echo $subset;19$subset = new Subset("A", "B", "C", "D", "E", "F", "G");20echo $subset;21$subset = new Subset("A", "B", "C", "D", "

Full Screen

Full Screen

__toString

Using AI Code Generation

copy

Full Screen

1$subset = new Subset();2echo $subset;3$subset = new Subset();4echo $subset;5{6}7{8function eat()9{10echo "Eating";11}12}13{14function bark()15{16echo "Barking";17}18}19$dog = new Dog();20$dog->eat();21$dog->bark();22{23function eat()24{25echo "Eating";26}27}28{29function eat()30{31echo "Eating bread";32}33}34$dog = new Dog();35$dog->eat();36{37function eat()38{39echo "Eating";40}41}42{43function eat()44{45echo "Eating bread";46}47function bark()48{49echo "Barking";50}51}52$dog = new Dog();53$dog->eat();54$dog->bark();

Full Screen

Full Screen

__toString

Using AI Code Generation

copy

Full Screen

1$objSubset = new Subset();2$objSubset->setSubsetId(2);3$objSubset->setSubsetCode("test");4echo $objSubset;5$objSubset = new Subset();6$objSubset->setSubsetId(2);7$objSubset->setSubsetCode("test");8echo $objSubset;9$objSubset = new Subset();10$objSubset->setSubsetId(2);11$objSubset->setSubsetCode("test");12echo $objSubset;13$objSubset = new Subset();14$objSubset->setSubsetId(2);15$objSubset->setSubsetCode("test");16echo $objSubset;17$objSubset = new Subset();18$objSubset->setSubsetId(2);19$objSubset->setSubsetCode("test");20echo $objSubset;21$objSubset = new Subset();22$objSubset->setSubsetId(2);23$objSubset->setSubsetCode("test");24echo $objSubset;25$objSubset = new Subset();26$objSubset->setSubsetId(2);27$objSubset->setSubsetCode("test");28echo $objSubset;29$objSubset = new Subset();30$objSubset->setSubsetId(2);31$objSubset->setSubsetCode("test");32echo $objSubset;33$objSubset = new Subset();34$objSubset->setSubsetId(2);35$objSubset->setSubsetCode("test");36echo $objSubset;37$objSubset = new Subset();38$objSubset->setSubsetId(2);39$objSubset->setSubsetCode("test");40echo $objSubset;41$objSubset = new Subset();42$objSubset->setSubsetId(2);43$objSubset->setSubsetCode("test");

Full Screen

Full Screen

__toString

Using AI Code Generation

copy

Full Screen

1$subset = new Subset();2$subset->setString('hello');3$subset->setLength(3);4echo $subset;5class Subset {6 private $string;7 private $length;8 public function setString($string) {9 $this->string = $string;10 }11 public function setLength($length) {12 $this->length = $length;13 }14 public function __toString() {15 return substr($this->string, 0, $this->length);16 }17}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Mockery automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in Subset

Trigger __toString code on LambdaTest Cloud Grid

Execute automation tests with __toString on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful