Best Mockery code snippet using Any.match
WebformBreadcrumbBuilderTest.php
Source:WebformBreadcrumbBuilderTest.php
...144 * @dataProvider providerTestApplies145 * @covers ::applies146 */147 public function testApplies($expected, $route_name = NULL, array $parameter_map = []) {148 $route_match = $this->getMockRouteMatch($route_name, $parameter_map);149 $this->assertEquals($expected, $this->breadcrumbBuilder->applies($route_match));150 }151 /**152 * Provides test data for testApplies().153 *154 * @return array155 * Array of datasets for testApplies().156 */157 public function providerTestApplies() {158 $this->setUpMockEntities();159 $tests = [160 [FALSE],161 [FALSE, 'not'],162 [FALSE, 'webform'],163 [FALSE, 'entity.webform'],164 [TRUE, 'entity.webform.handler.'],165 [TRUE, 'entity.webform_ui.element'],166 [TRUE, 'entity.webform.user.submissions'],167 // Source entity.168 [TRUE, 'entity.{source_entity}.webform'],169 [TRUE, 'entity.{source_entity}.webform_submission'],170 [TRUE, 'entity.node.webform'],171 [TRUE, 'entity.node.webform_submission'],172 [TRUE, 'entity.node.webform.user.submissions'],173 // Submissions.174 [FALSE, 'entity.webform.user.submission'],175 [TRUE, 'entity.webform.user.submission', [['webform_submission', $this->webformSubmissionAccess]]],176 [TRUE, 'webform', [['webform_submission', $this->webformSubmissionAccess]]],177 // Translations.178 [FALSE, 'entity.webform.config_translation_overview'],179 [TRUE, 'entity.webform.config_translation_overview', [['webform', $this->webformAccess]]],180 ];181 return $tests;182 }183 /**184 * Tests WebformBreadcrumbBuilder::type.185 *186 * @param bool $expected187 * WebformBreadcrumbBuilder::type set via188 * WebformBreadcrumbBuilder::applies().189 * @param string|null $route_name190 * (optional) A route name.191 * @param array $parameter_map192 * (optional) An array of parameter names and values.193 *194 * @dataProvider providerTestType195 * @covers ::applies196 */197 public function testType($expected, $route_name = NULL, array $parameter_map = []) {198 $route_match = $this->getMockRouteMatch($route_name, $parameter_map);199 $this->breadcrumbBuilder->applies($route_match);200 $this->assertEquals($expected, $this->breadcrumbBuilder->getType());201 }202 /**203 * Provides test data for testType().204 *205 * @return array206 * Array of datasets for testType().207 */208 public function providerTestType() {209 $this->setUpMockEntities();210 $tests = [211 [NULL],212 // Source entity.213 ['webform_source_entity', 'entity.{source_entity}.webform'],214 ['webform_source_entity', 'entity.{source_entity}.webform_submission'],215 ['webform_source_entity', 'entity.node.webform'],216 ['webform_source_entity', 'entity.node.webform_submission'],217 // Element.218 ['webform_element', 'entity.webform_ui.element'],219 // Handler.220 ['webform_handler', 'entity.webform.handler.'],221 // User submissions.222 ['webform_user_submissions', 'entity.webform.user.submissions'],223 ['webform_source_entity', 'entity.{source_entity}.webform.user.submissions'],224 ['webform_source_entity', 'entity.node.webform.user.submissions'],225 // User submission.226 ['webform_user_submission', 'entity.webform.user.submission', [['webform_submission', $this->webformSubmission]]],227 // Submission.228 [NULL, 'entity.webform_submission.canonical', [['webform_submission', $this->webformSubmission]]],229 ['webform_submission', 'entity.webform_submission.canonical', [['webform_submission', $this->webformSubmissionAccess]]],230 // Webform.231 [NULL, 'entity.webform.canonical', [['webform', $this->webform]]],232 ['webform', 'entity.webform.canonical', [['webform', $this->webformAccess]]],233 // Webform template.234 ['webform_template', 'entity.webform.canonical', [['webform', $this->webformTemplate]]],235 ];236 return $tests;237 }238 /**239 * Test build source entity breadcrumbs.240 */241 public function testBuildSourceEntity() {242 $this->setSourceEntity($this->nodeAccess);243 $route_match = $this->getMockRouteMatch('entity.node.webform', [244 ['webform', $this->webformAccess],245 ['node', $this->nodeAccess],246 ]);247 $links = [248 Link::createFromRoute('Home', '<front>'),249 $this->node->toLink(),250 ];251 $this->assertLinks($route_match, $links);252 }253 /**254 * Test build source entity submissions breadcrumbs.255 */256 public function testBuildSourceEntitySubmissions() {257 $this->setSourceEntity($this->nodeAccess);258 $route_match = $this->getMockRouteMatch('entity.node.webform.user.submission', [259 ['webform_submission', $this->webformSubmissionAccess],260 ['webform', $this->webform],261 ['node', $this->node],262 ]);263 $links = [264 Link::createFromRoute('Home', '<front>'),265 $this->node->toLink(),266 Link::createFromRoute('Submissions', 'entity.node.webform.user.submissions', ['node' => 1]),267 ];268 $this->assertLinks($route_match, $links);269 }270 /**271 * Test build source entity submissions breadcrumbs.272 */273 public function testBuildSourceEntityResults() {274 $this->setSourceEntity($this->nodeAccess);275 $route_match = $this->getMockRouteMatch('entity.node.webform_submission.canonical', [276 ['webform_submission', $this->webformSubmissionAccess],277 ['webform', $this->webform],278 ['node', $this->node],279 ]);280 $links = [281 Link::createFromRoute('Home', '<front>'),282 $this->node->toLink(),283 Link::createFromRoute('Results', 'entity.node.webform.results_submissions', ['node' => 1]),284 ];285 $this->assertLinks($route_match, $links);286 }287 /**288 * Test build source entity submissions breadcrumbs.289 */290 public function testBuildSourceEntityUserResults() {291 $this->setSourceEntity($this->node);292 $webform_submission_access = $this->getMockBuilder('Drupal\webform\WebformSubmissionInterface')293 ->disableOriginalConstructor()294 ->getMock();295 $webform_submission_access->expects($this->any())296 ->method('access')297 ->will($this->returnCallback(function ($operation) {298 return ($operation === 'view_own');299 }));300 $route_match = $this->getMockRouteMatch('entity.node.webform_submission.canonical', [301 ['webform_submission', $webform_submission_access],302 ['webform', $this->webform],303 ['node', $this->node],304 ]);305 $links = [306 Link::createFromRoute('Home', '<front>'),307 $this->node->toLink(),308 Link::createFromRoute('Results', 'entity.node.webform.user.submissions', ['node' => 1]),309 ];310 $this->assertLinks($route_match, $links);311 }312 /**313 * Test build templates breadcrumbs.314 */315 public function testBuildTemplates() {316 $route_match = $this->getMockRouteMatch('entity.webform.canonical', [317 ['webform', $this->webformTemplate],318 ]);319 $links = [320 Link::createFromRoute('Home', '<front>'),321 Link::createFromRoute('Administration', 'system.admin'),322 Link::createFromRoute('Structure', 'system.admin_structure'),323 Link::createFromRoute('Webforms', 'entity.webform.collection'),324 Link::createFromRoute('Templates', 'entity.webform.templates'),325 ];326 $this->assertLinks($route_match, $links);327 }328 /**329 * Test build element breadcrumbs.330 */331 public function testBuildElements() {332 $route_match = $this->getMockRouteMatch('entity.webform_ui.element', [333 ['webform', $this->webform],334 ]);335 $links = [336 Link::createFromRoute('Home', '<front>'),337 Link::createFromRoute('Administration', 'system.admin'),338 Link::createFromRoute('Structure', 'system.admin_structure'),339 Link::createFromRoute('Webforms', 'entity.webform.collection'),340 Link::createFromRoute($this->webform->label(), 'entity.webform.canonical', ['webform' => $this->webform->id()]),341 Link::createFromRoute('Elements', 'entity.webform.edit_form', ['webform' => $this->webform->id()]),342 ];343 $this->assertLinks($route_match, $links);344 }345 /**346 * Test build handler breadcrumbs.347 */348 public function testBuildHandlers() {349 // Check source entity.350 $route_match = $this->getMockRouteMatch('entity.webform.handler.add_form', [351 ['webform', $this->webform],352 ]);353 $links = [354 Link::createFromRoute('Home', '<front>'),355 Link::createFromRoute('Administration', 'system.admin'),356 Link::createFromRoute('Structure', 'system.admin_structure'),357 Link::createFromRoute('Webforms', 'entity.webform.collection'),358 Link::createFromRoute($this->webform->label(), 'entity.webform.canonical', ['webform' => $this->webform->id()]),359 Link::createFromRoute('Emails / Handlers', 'entity.webform.handlers', ['webform' => $this->webform->id()]),360 ];361 $this->assertLinks($route_match, $links);362 }363 /**364 * Test build submissions breadcrumbs.365 */366 public function testBuildSubmissions() {367 $route_match = $this->getMockRouteMatch('entity.webform_submission.canonical', [368 ['webform_submission', $this->webformSubmissionAccess],369 ]);370 $links = [371 Link::createFromRoute('Home', '<front>'),372 Link::createFromRoute('Administration', 'system.admin'),373 Link::createFromRoute('Structure', 'system.admin_structure'),374 Link::createFromRoute('Webforms', 'entity.webform.collection'),375 Link::createFromRoute($this->webform->label(), 'entity.webform.canonical', ['webform' => $this->webform->id()]),376 Link::createFromRoute('Results', 'entity.webform.results_submissions', ['webform' => $this->webform->id()]),377 ];378 $this->assertLinks($route_match, $links);379 }380 /**381 * Test build user submissions breadcrumbs.382 */383 public function testBuildUserSubmissions() {384 // Check without view own access.385 $route_match = $this->getMockRouteMatch('entity.webform.user.submission', [386 ['webform_submission', $this->webformSubmission],387 ]);388 $links = [389 Link::createFromRoute($this->webform->label(), 'entity.webform.canonical', ['webform' => $this->webform->id()]),390 ];391 $this->assertLinks($route_match, $links);392 // Check with view own access.393 $route_match = $this->getMockRouteMatch('entity.webform.user.submission', [394 ['webform_submission', $this->webformSubmissionAccess],395 ]);396 $links = [397 Link::createFromRoute($this->webform->label(), 'entity.webform.canonical', ['webform' => $this->webform->id()]),398 Link::createFromRoute('Submissions', 'entity.webform.user.submissions', ['webform' => $this->webform->id()]),399 ];400 $this->assertLinks($route_match, $links);401 }402 /**403 * Test build user submission breadcrumbs.404 */405 public function testBuildUserSubmission() {406 $route_match = $this->getMockRouteMatch('entity.webform.user.submissions', [407 ['webform', $this->webform],408 ]);409 $links = [410 Link::createFromRoute($this->webform->label(), 'entity.webform.canonical', ['webform' => $this->webform->id()]),411 ];412 $this->assertLinks($route_match, $links);413 }414 /* ************************************************************************ */415 // Helper functions.416 /* ************************************************************************ */417 /**418 * Assert breadcrumb builder generates links for specified route match.419 *420 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match421 * A mocked route match.422 * @param array $links423 * An array of breadcrumb links.424 */425 protected function assertLinks(RouteMatchInterface $route_match, array $links) {426 $this->breadcrumbBuilder->applies($route_match);427 $breadcrumb = $this->breadcrumbBuilder->build($route_match);428 $this->assertEquals($links, $breadcrumb->getLinks());429 }430 /**431 * Set request handler's source entity.432 *433 * @param \Drupal\Core\Entity\EntityInterface $entity434 * An entity.435 */436 protected function setSourceEntity(EntityInterface $entity) {437 // Set the node as the request handler's source entity.438 $this->requestHandler->expects($this->any())439 ->method('getCurrentSourceEntity')440 ->will($this->returnValue($entity));441 }442 /**443 * Get mock route match.444 *445 * @param string|null $route_name446 * (optional) A route name.447 * @param array $parameter_map448 * (optional) An array of parameter names and values.449 *450 * @return \Drupal\Core\Routing\RouteMatchInterface451 * A mocked route match.452 */453 protected function getMockRouteMatch($route_name = NULL, array $parameter_map = []) {454 $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface');455 $route_match->expects($this->any())456 ->method('getRouteName')457 ->will($this->returnValue($route_name));458 $route_match->expects($this->any())459 ->method('getParameter')460 ->will($this->returnValueMap($parameter_map));461 /** @var \Drupal\Core\Routing\RouteMatchInterface $route_match */462 return $route_match;463 }464 /**465 * Setup mock webform and webform submission entities.466 *467 * This is called before every test is setup and provider initialization.468 */469 protected function setUpMockEntities() {470 // Only initial mock entities once.471 if (isset($this->node)) {472 return;473 }474 /* node entities */475 $this->node = $this->getMockBuilder('Drupal\node\NodeInterface')476 ->disableOriginalConstructor()...
fnmatch_variation.phpt
Source:fnmatch_variation.phpt
1--TEST--2Test fnmatch() function: Variations3--SKIPIF--4<?php5if (!function_exists('fnmatch'))6 die("skip fnmatch() function is not available");7?>8--FILE--9<?php10echo "*** Testing fnmatch() with file and various patterns ***\n";11$file_name = __DIR__."/match.tmp";12/* avoid using \, it breaks the pattern */13if (substr(PHP_OS, 0, 3) == 'WIN') {14 $file_name = str_replace('\\','/', $file_name);15}16fopen($file_name, "w");17$pattern_arr = array(180 => "*.tmp",191 => "match*",202 => "mat*",213 => "mat*tmp",224 => "m*t",235 => "ma[pt]ch*",246 => "*.t*",257 => "***.tmp",268 => "match**",279 => "*.t*p",2810 => "",2911 => "match",3012 => ".tmp",3113 => "?match",3214 => "match?tmp",3315 => "?tmp",3416 => "match?",3517 => "?match?",3618 => "match.tmp",3719 => "/match.tmp",3820 => "/match.tmp/",3921 => 'match.tmp',4022 => 'match.tmp\0',4123 => "match.tmp\0",4224 => "match\0.tmp",4325 => chr(109).chr(97)."tch.tmp",4426 => chr(109).chr(97).chr(116).chr(99).chr(104).".tmp",4527 => chr(109).chr(97).chr(116).chr(99).chr(104).chr(46).chr(116).chr(120).chr(116),4628 => chr(109).chr(97).chr(116).chr(99).chr(104).".".chr(116).chr(120).chr(116),4729 => "MATCH.TMP",4830 => "MATCH*",4931 => $file_name,50/* binary inputs */5132 => b"match*",5233 => b"*.tmp",5334 => b"mat*",5435 => b"mat*tmp",5536 => b"m*t",56);57for( $i = 0; $i<count($pattern_arr); $i++ ) {58 echo "-- Iteration $i --\n";59 try {60 var_dump( fnmatch($pattern_arr[$i], $file_name) );61 } catch (Error $e) {62 echo $e->getMessage(), "\n";63 }64}65unlink($file_name);66echo "\n*** Testing fnmatch() with other types other than files ***";67/* defining a common function */68function match_( $pattern, $string ) {69 for( $i = 0; $i<count($pattern); $i++ ) {70 echo "-- Iteration $i --\n";71 for( $j = 0; $j<count($string); $j++ ) {72 try {73 var_dump( fnmatch($pattern[$i], $string[$j]) );74 } catch (Error $e) {75 echo $e->getMessage(), "\n";76 }77 }78 }79}80echo "\n--- With Integers ---\n";81$int_arr = array(82 16,83 16.00,84 020,85 020.00,86 0xF,87 0xF000088);89match_($int_arr, $int_arr);90echo "\n--- With Strings ---\n";91$str_arr = array(92 "string",93 "string\0",94 'string',95 "str\0ing",96 "stringstring",97 /* binary input */98 b"string"99);100match_($str_arr, $str_arr);101echo "\n--- With booleans ---\n";102$bool_arr = array(103 TRUE,104 true,105 1,106 10,107 FALSE,108 false,109 0,110 "",111 "string"112);113match_($bool_arr, $bool_arr);114echo "\n--- With NULL ---\n";115$null_arr = array(116 NULL,117 null,118 "",119 "\0",120 "string",121 0122);123match_($null_arr, $null_arr);124echo "\n*** Done ***\n";125?>126--EXPECT--127*** Testing fnmatch() with file and various patterns ***128-- Iteration 0 --129bool(true)130-- Iteration 1 --131bool(false)132-- Iteration 2 --133bool(false)134-- Iteration 3 --135bool(false)136-- Iteration 4 --137bool(false)138-- Iteration 5 --139bool(false)140-- Iteration 6 --141bool(true)142-- Iteration 7 --143bool(true)144-- Iteration 8 --145bool(false)146-- Iteration 9 --147bool(true)148-- Iteration 10 --149bool(false)150-- Iteration 11 --151bool(false)152-- Iteration 12 --153bool(false)154-- Iteration 13 --155bool(false)156-- Iteration 14 --157bool(false)158-- Iteration 15 --159bool(false)160-- Iteration 16 --161bool(false)162-- Iteration 17 --163bool(false)164-- Iteration 18 --165bool(false)166-- Iteration 19 --167bool(false)168-- Iteration 20 --169bool(false)170-- Iteration 21 --171bool(false)172-- Iteration 22 --173bool(false)174-- Iteration 23 --175fnmatch(): Argument #1 ($pattern) must not contain any null bytes176-- Iteration 24 --177fnmatch(): Argument #1 ($pattern) must not contain any null bytes178-- Iteration 25 --179bool(false)180-- Iteration 26 --181bool(false)182-- Iteration 27 --183bool(false)184-- Iteration 28 --185bool(false)186-- Iteration 29 --187bool(false)188-- Iteration 30 --189bool(false)190-- Iteration 31 --191bool(true)192-- Iteration 32 --193bool(false)194-- Iteration 33 --195bool(true)196-- Iteration 34 --197bool(false)198-- Iteration 35 --199bool(false)200-- Iteration 36 --201bool(false)202*** Testing fnmatch() with other types other than files ***203--- With Integers ---204-- Iteration 0 --205bool(true)206bool(true)207bool(true)208bool(false)209bool(false)210bool(false)211-- Iteration 1 --212bool(true)213bool(true)214bool(true)215bool(false)216bool(false)217bool(false)218-- Iteration 2 --219bool(true)220bool(true)221bool(true)222bool(false)223bool(false)224bool(false)225-- Iteration 3 --226bool(false)227bool(false)228bool(false)229bool(true)230bool(false)231bool(false)232-- Iteration 4 --233bool(false)234bool(false)235bool(false)236bool(false)237bool(true)238bool(false)239-- Iteration 5 --240bool(false)241bool(false)242bool(false)243bool(false)244bool(false)245bool(true)246--- With Strings ---247-- Iteration 0 --248bool(true)249fnmatch(): Argument #2 ($filename) must not contain any null bytes250bool(true)251fnmatch(): Argument #2 ($filename) must not contain any null bytes252bool(false)253bool(true)254-- Iteration 1 --255fnmatch(): Argument #1 ($pattern) must not contain any null bytes256fnmatch(): Argument #1 ($pattern) must not contain any null bytes257fnmatch(): Argument #1 ($pattern) must not contain any null bytes258fnmatch(): Argument #1 ($pattern) must not contain any null bytes259fnmatch(): Argument #1 ($pattern) must not contain any null bytes260fnmatch(): Argument #1 ($pattern) must not contain any null bytes261-- Iteration 2 --262bool(true)263fnmatch(): Argument #2 ($filename) must not contain any null bytes264bool(true)265fnmatch(): Argument #2 ($filename) must not contain any null bytes266bool(false)267bool(true)268-- Iteration 3 --269fnmatch(): Argument #1 ($pattern) must not contain any null bytes270fnmatch(): Argument #1 ($pattern) must not contain any null bytes271fnmatch(): Argument #1 ($pattern) must not contain any null bytes272fnmatch(): Argument #1 ($pattern) must not contain any null bytes273fnmatch(): Argument #1 ($pattern) must not contain any null bytes274fnmatch(): Argument #1 ($pattern) must not contain any null bytes275-- Iteration 4 --276bool(false)277fnmatch(): Argument #2 ($filename) must not contain any null bytes278bool(false)279fnmatch(): Argument #2 ($filename) must not contain any null bytes280bool(true)281bool(false)282-- Iteration 5 --283bool(true)284fnmatch(): Argument #2 ($filename) must not contain any null bytes285bool(true)286fnmatch(): Argument #2 ($filename) must not contain any null bytes287bool(false)288bool(true)289--- With booleans ---290-- Iteration 0 --291bool(true)292bool(true)293bool(true)294bool(false)295bool(false)296bool(false)297bool(false)298bool(false)299bool(false)300-- Iteration 1 --301bool(true)302bool(true)303bool(true)304bool(false)305bool(false)306bool(false)307bool(false)308bool(false)309bool(false)310-- Iteration 2 --311bool(true)312bool(true)313bool(true)314bool(false)315bool(false)316bool(false)317bool(false)318bool(false)319bool(false)320-- Iteration 3 --321bool(false)322bool(false)323bool(false)324bool(true)325bool(false)326bool(false)327bool(false)328bool(false)329bool(false)330-- Iteration 4 --331bool(false)332bool(false)333bool(false)334bool(false)335bool(true)336bool(true)337bool(false)338bool(true)339bool(false)340-- Iteration 5 --341bool(false)342bool(false)343bool(false)344bool(false)345bool(true)346bool(true)347bool(false)348bool(true)349bool(false)350-- Iteration 6 --351bool(false)352bool(false)353bool(false)354bool(false)355bool(false)356bool(false)357bool(true)358bool(false)359bool(false)360-- Iteration 7 --361bool(false)362bool(false)363bool(false)364bool(false)365bool(true)366bool(true)367bool(false)368bool(true)369bool(false)370-- Iteration 8 --371bool(false)372bool(false)373bool(false)374bool(false)375bool(false)376bool(false)377bool(false)378bool(false)379bool(true)380--- With NULL ---381-- Iteration 0 --382bool(true)383bool(true)384bool(true)385fnmatch(): Argument #2 ($filename) must not contain any null bytes386bool(false)387bool(false)388-- Iteration 1 --389bool(true)390bool(true)391bool(true)392fnmatch(): Argument #2 ($filename) must not contain any null bytes393bool(false)394bool(false)395-- Iteration 2 --396bool(true)397bool(true)398bool(true)399fnmatch(): Argument #2 ($filename) must not contain any null bytes400bool(false)401bool(false)402-- Iteration 3 --403fnmatch(): Argument #1 ($pattern) must not contain any null bytes404fnmatch(): Argument #1 ($pattern) must not contain any null bytes405fnmatch(): Argument #1 ($pattern) must not contain any null bytes406fnmatch(): Argument #1 ($pattern) must not contain any null bytes407fnmatch(): Argument #1 ($pattern) must not contain any null bytes408fnmatch(): Argument #1 ($pattern) must not contain any null bytes409-- Iteration 4 --410bool(false)411bool(false)412bool(false)413fnmatch(): Argument #2 ($filename) must not contain any null bytes414bool(true)415bool(false)416-- Iteration 5 --417bool(false)418bool(false)419bool(false)420fnmatch(): Argument #2 ($filename) must not contain any null bytes421bool(false)422bool(true)423*** Done ***...
upgrade.php
Source:upgrade.php
...15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.16/**17 * Matching question type upgrade code.18 *19 * @package qtype_match20 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later22 */23defined('MOODLE_INTERNAL') || die();24/**25 * Upgrade code for the matching question type.26 * @param int $oldversion the version we are upgrading from.27 */28function xmldb_qtype_match_upgrade($oldversion) {29 global $CFG, $DB;30 $dbman = $DB->get_manager();31 // Moodle v2.2.0 release upgrade line.32 // Put any upgrade step following this.33 // Moodle v2.3.0 release upgrade line.34 // Put any upgrade step following this.35 // Moodle v2.4.0 release upgrade line.36 // Put any upgrade step following this.37 if ($oldversion < 2013012099) {38 // Find duplicate rows before they break the 2013012103 step below.39 $problemids = $DB->get_recordset_sql("40 SELECT question, MIN(id) AS recordidtokeep41 FROM {question_match}42 GROUP BY question43 HAVING COUNT(1) > 144 ");45 foreach ($problemids as $problem) {46 $DB->delete_records_select('question_match',47 'question = ? AND id > ?',48 array($problem->question, $problem->recordidtokeep));49 }50 $problemids->close();51 // Shortanswer savepoint reached.52 upgrade_plugin_savepoint(true, 2013012099, 'qtype', 'match');53 }54 if ($oldversion < 2013012100) {55 // Define table question_match to be renamed to qtype_match_options.56 $table = new xmldb_table('question_match');57 // Launch rename table for qtype_match_options.58 $dbman->rename_table($table, 'qtype_match_options');59 // Record that qtype_match savepoint was reached.60 upgrade_plugin_savepoint(true, 2013012100, 'qtype', 'match');61 }62 if ($oldversion < 2013012101) {63 // Define key question (foreign) to be dropped form qtype_match_options.64 $table = new xmldb_table('qtype_match_options');65 $key = new xmldb_key('question', XMLDB_KEY_FOREIGN, array('question'), 'question', array('id'));66 // Launch drop key question.67 $dbman->drop_key($table, $key);68 // Record that qtype_match savepoint was reached.69 upgrade_plugin_savepoint(true, 2013012101, 'qtype', 'match');70 }71 if ($oldversion < 2013012102) {72 // Rename field question on table qtype_match_options to questionid.73 $table = new xmldb_table('qtype_match_options');74 $field = new xmldb_field('question', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'id');75 // Launch rename field question.76 $dbman->rename_field($table, $field, 'questionid');77 // Record that qtype_match savepoint was reached.78 upgrade_plugin_savepoint(true, 2013012102, 'qtype', 'match');79 }80 if ($oldversion < 2013012103) {81 // Define key questionid (foreign-unique) to be added to qtype_match_options.82 $table = new xmldb_table('qtype_match_options');83 $key = new xmldb_key('questionid', XMLDB_KEY_FOREIGN_UNIQUE, array('questionid'), 'question', array('id'));84 // Launch add key questionid.85 $dbman->add_key($table, $key);86 // Record that qtype_match savepoint was reached.87 upgrade_plugin_savepoint(true, 2013012103, 'qtype', 'match');88 }89 if ($oldversion < 2013012104) {90 // Define field subquestions to be dropped from qtype_match_options.91 $table = new xmldb_table('qtype_match_options');92 $field = new xmldb_field('subquestions');93 // Conditionally launch drop field subquestions.94 if ($dbman->field_exists($table, $field)) {95 $dbman->drop_field($table, $field);96 }97 // Record that qtype_match savepoint was reached.98 upgrade_plugin_savepoint(true, 2013012104, 'qtype', 'match');99 }100 if ($oldversion < 2013012105) {101 // Define table question_match_sub to be renamed to qtype_match_subquestions.102 $table = new xmldb_table('question_match_sub');103 // Launch rename table for qtype_match_subquestions.104 $dbman->rename_table($table, 'qtype_match_subquestions');105 // Record that qtype_match savepoint was reached.106 upgrade_plugin_savepoint(true, 2013012105, 'qtype', 'match');107 }108 if ($oldversion < 2013012106) {109 // Define key question (foreign) to be dropped form qtype_match_subquestions.110 $table = new xmldb_table('qtype_match_subquestions');111 $key = new xmldb_key('question', XMLDB_KEY_FOREIGN, array('question'), 'question', array('id'));112 // Launch drop key question.113 $dbman->drop_key($table, $key);114 // Record that qtype_match savepoint was reached.115 upgrade_plugin_savepoint(true, 2013012106, 'qtype', 'match');116 }117 if ($oldversion < 2013012107) {118 // Rename field question on table qtype_match_subquestions to questionid.119 $table = new xmldb_table('qtype_match_subquestions');120 $field = new xmldb_field('question', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'id');121 // Launch rename field question.122 $dbman->rename_field($table, $field, 'questionid');123 // Record that qtype_match savepoint was reached.124 upgrade_plugin_savepoint(true, 2013012107, 'qtype', 'match');125 }126 if ($oldversion < 2013012108) {127 // Define key questionid (foreign) to be added to qtype_match_subquestions.128 $table = new xmldb_table('qtype_match_subquestions');129 $key = new xmldb_key('questionid', XMLDB_KEY_FOREIGN, array('questionid'), 'question', array('id'));130 // Launch add key questionid.131 $dbman->add_key($table, $key);132 // Record that qtype_match savepoint was reached.133 upgrade_plugin_savepoint(true, 2013012108, 'qtype', 'match');134 }135 if ($oldversion < 2013012109) {136 // Define field code to be dropped from qtype_match_subquestions.137 // The field code has not been needed since the new question engine in138 // Moodle 2.1. It should be safe to drop it now.139 $table = new xmldb_table('qtype_match_subquestions');140 $field = new xmldb_field('code');141 // Conditionally launch drop field code.142 if ($dbman->field_exists($table, $field)) {143 $dbman->drop_field($table, $field);144 }145 // Record that qtype_match savepoint was reached.146 upgrade_plugin_savepoint(true, 2013012109, 'qtype', 'match');147 }148 // Moodle v2.5.0 release upgrade line.149 // Put any upgrade step following this.150 // Moodle v2.6.0 release upgrade line.151 // Put any upgrade step following this.152 // Moodle v2.7.0 release upgrade line.153 // Put any upgrade step following this.154 return true;155}...
match
Using AI Code Generation
1$any = new Any();2$any->match($url);3$any = new Any();4$any->match($url);5$any = new Any();6$any->match($url);7$any = new Any();8$any->match($url);9$any = new Any();10$any->match($url);11$any = new Any();12$any->match($url);13$any = new Any();14$any->match($url);15$any = new Any();16$any->match($url);17$any = new Any();18$any->match($url);19$any = new Any();20$any->match($url);21$any = new Any();22$any->match($url);23$any = new Any();24$any->match($url);25$any = new Any();26$any->match($url);
match
Using AI Code Generation
1$any = new Any();2$any->match('/1.php');3$any = new Any();4$any->match('/2.php');5$any = new Any();6$any->match('/3.php');7The match() method of
match
Using AI Code Generation
1require_once 'Any.php';2$any = new Any();3$any->match('1.php');4require_once 'Any.php';5$any = new Any();6$any->match('2.php');7require_once 'Any.php';8$any = new Any();9$any->match('3.php');10require_once 'Any.php';11$any = new Any();12$any->match('4.php');13require_once 'Any.php';14$any = new Any();15$any->match('5.php');16require_once 'Any.php';17$any = new Any();18$any->match('6.php');19require_once 'Any.php';20$any = new Any();21$any->match('7.php');22require_once 'Any.php';23$any = new Any();24$any->match('8.php');25require_once 'Any.php';26$any = new Any();27$any->match('9.php');28require_once 'Any.php';29$any = new Any();30$any->match('10.php');31require_once 'Any.php';32$any = new Any();33$any->match('11.php');
match
Using AI Code Generation
1$any = new Any();2$any->match("abc");3$any->match("d");4$any->match("e");5$any->match("f");6$any->match("g");7$any->match("h");8$any->match("i");9$any->match("j");10$any->match("k");11$any->match("l");12$any->match("m");13$any->match("n");14$any->match("o");15$any->match("p");16$any->match("q");17$any->match("r");18$any->match("s");19$any->match("t");20$any->match("u");21$any->match("v");22$any->match("w");23$any->match("x");24$any->match("y");25$any->match("z");26$any->match("A");27$any->match("B");28$any->match("C");29$any->match("D");30$any->match("E");31$any->match("F");32$any->match("G");33$any->match("H");34$any->match("I");35$any->match("J");36$any->match("K");37$any->match("L");38$any->match("M");39$any->match("N");40$any->match("O");41$any->match("P");42$any->match("Q");43$any->match("R");44$any->match("S");45$any->match("T");46$any->match("U");47$any->match("V");48$any->match("W");49$any->match("X");50$any->match("Y");51$any->match("Z");52$any->match("0");53$any->match("1");54$any->match("2");55$any->match("3");56$any->match("4");57$any->match("5");58$any->match("6");59$any->match("7");60$any->match("8");61$any->match("9");62$any->match(" ");63$any->match("!");64$any->match("@");65$any->match("#");66$any->match("$");67$any->match("%");68$any->match("^");69$any->match("&");70$any->match("*");71$any->match("(");72$any->match(")");73$any->match("-");
match
Using AI Code Generation
1$any = new Any();2$any->match('1');3$any->match('2');4$any->match('3');5$all = new All();6$all->match('1');7$all->match('2');8$all->match('3');9How to use PHP ReflectionClass::getMethods() Function10How to use PHP ReflectionClass::getProperties() Function11How to use PHP ReflectionClass::getConstant() Function12How to use PHP ReflectionClass::getConstants() Function13How to use PHP ReflectionClass::getConstructor() Function14How to use PHP ReflectionClass::getInterfaceNames() Function15How to use PHP ReflectionClass::getInterfaces() Function16How to use PHP ReflectionClass::getMethods() Function?17How to use PHP ReflectionClass::getModifiers() Function18How to use PHP ReflectionClass::getParentClass() Function19How to use PHP ReflectionClass::getProperties() Function?20How to use PHP ReflectionClass::getStaticProperties() Function21How to use PHP ReflectionClass::getStaticPropertyValue() Function22How to use PHP ReflectionClass::getTraitAliases() Function23How to use PHP ReflectionClass::getTraitNames() Function24How to use PHP ReflectionClass::getTraits() Function25How to use PHP ReflectionClass::hasConstant() Function26How to use PHP ReflectionClass::hasMethod() Function27How to use PHP ReflectionClass::hasProperty() Function28How to use PHP ReflectionClass::implementsInterface() Function29How to use PHP ReflectionClass::inNamespace() Function30How to use PHP ReflectionClass::isAbstract() Function31How to use PHP ReflectionClass::isAnonymous() Function32How to use PHP ReflectionClass::isCloneable() Function33How to use PHP ReflectionClass::isFinal() Function34How to use PHP ReflectionClass::isInstance() Function35How to use PHP ReflectionClass::isInstantiable() Function36How to use PHP ReflectionClass::isInterface() Function37How to use PHP ReflectionClass::isInternal() Function38How to use PHP ReflectionClass::isIterateable() Function39How to use PHP ReflectionClass::isSubclassOf() Function40How to use PHP ReflectionClass::isTrait() Function
match
Using AI Code Generation
1$any = new Any();2$any->match('1.php');3$any = new Any();4$any->match('1.php');5$any = new Any();6$any->match('1.php');7$any = new Any();8$any->match('1.php');9$any = new Any();10$any->match('1.php');11$any = new Any();12$any->match('1.php');13$any = new Any();14$any->match('1.php');15$any = new Any();16$any->match('1.php');17$any = new Any();18$any->match('1.php');19$any = new Any();20$any->match('1.php');21$any = new Any();22$any->match('1.php');23$any = new Any();24$any->match('1.php');25$any = new Any();26$any->match('1.php');
match
Using AI Code Generation
1$any = new Any(1);2$any->match(3 1 => function() { echo "One"; },4 2 => function() { echo "Two"; }5);6$any = new Any(2);7$any->match(8 1 => function() { echo "One"; },9 2 => function() { echo "Two"; }10);11$any = new Any(3);12$any->match(13 1 => function() { echo "One"; },14 2 => function() { echo "Two"; }15);16$any = new Any(1);17$any->match(18 1 => function() { echo "One"; },19 2 => function() { echo "Two"; }20);21$any = new Any(2);22$any->match(23 1 => function() { echo "One"; },24 2 => function() { echo "Two"; }25);26$any = new Any(3);27$any->match(28 1 => function() { echo "One"; },29 2 => function() { echo "Two"; }30);31$any = new Any(1);32$any->match(33 1 => function() { echo "One"; },34 2 => function() { echo "Two"; }35);36$any = new Any(2);37$any->match(38 1 => function() { echo "One"; },39 2 => function() { echo "Two"; }40);41$any = new Any(3);42$any->match(43 1 => function() { echo "One"; },44 2 => function() { echo "Two"; }45);
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with match on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!