How to use testClass method of fold class

Best Atoum code snippet using fold.testClass

index.php

Source:index.php Github

copy

Full Screen

1<!doctype html>2<html>3<head>4<meta charset="UTF-8" />5<style type="text/css">6* {box-sizing:border-box; -moz-box-sizing: border-box; }7body { font-size: 14px; line-height: 22px;}8</style>9</head>10<body onload="ini()">11<input type="file" id="file-input" />12<a href="javascript:exportFile()">save</a> |13<?php14include("php/prelude.php");15include("php/Foo.php");16include("php/Foo_UL.php");17include("php/Foo_TREE.php");18include("php/F_A1.php");19include("php/F_A2.php");20include("php/F_A3.php");21include("php/A1_I1.php");22include("php/A1_I3.php");23include("php/A1_I3Table.php");24include("php/A2_I5.php");25include("php/A3_ShowTestclasses.php");26$str = file_get_contents("example1.json");27$json = json_decode($str, true);28#print_r($json);29$p = Project::fromJSON($json);30#echo $p->msg;31#echo $p->fold(new FOO_UL());32#$i1 = new A1_I1 ();33#$i1->morestyle = "font-size: 24px;";34#echo $p->fold($i1);35$i1 = new A1_I1 ();36$i1->keyorder["foo"] = array(1,2,6); #array_keys ($p->attributes);37$i3 = new A1_I3 ();38$i3->attrs = $p->attributes;39$i3->keyorder["foo"] = $i1->keyorder["foo"];40$i3t = new A1_I3Table();41$i3t->keyorder["foo"] = $i1->keyorder["foo"];42?>43<a href="javascript: refreshAll()">refresh</a> |44<a href="javascript: refreshTreeUL()">refresh UL</a> |45<a href="javascript: refreshTreeULBig()">show all</a> |46<a href="javascript: refreshTestclassList()">show TCS</a>47<a href="javascript: addProduct()">+P</a>48<br> most red and pink values can be edited by clicking on it49<table width="100%">50<tr>51 <td width="40%" valign="top">52 <div id="o0">53 <h3>rendered by PHP:</h3>54 <?= $p->fold($i3) ?>55 </div>56 </td>57 <td width="200px" valign="top">58 <div id="tcs">59 <h3>rendered by PHP:</h3>60 <?= $p->fold(new A3_ShowTestclasses ()) ?>61 </div>62 </td>63 <td valign="top">64 <div id="o1">65 <h3>rendered by PHP:</h3>66 <?= $p->fold($i1) ?>67 </div>68 </td>69</table>70<div id="t1">71<?= $p->fold($i3t) ?>72</div>73<script type="text/javascript" src="jquery-1.11.2.min.js"></script>74<!-- <script type="text/javascript" src="jquery-ui.min.js"></script> -->75<script type="text/javascript" src="jquery.jeditable.mini.js" ></script>76<script type="text/javascript" src="js/prelude.js"></script>77<script type="text/javascript" src="js/Foo.js"></script>78<script type="text/javascript" src="js/Foo_UL.js"></script>79<script type="text/javascript" src="js/Foo_TREE.js"></script>80<script type="text/javascript" src="js/Foo_I2.js"></script>81<script type="text/javascript" src="js/F_A1.js"></script>82<script type="text/javascript" src="js/F_A2.js"></script>83<script type="text/javascript" src="js/F_A3.js"></script>84<script type="text/javascript" src="js/A1_I1.js"></script>85<script type="text/javascript" src="js/A1_I3.js"></script>86<script type="text/javascript" src="js/A1_I3Table.js"></script>87<script type="text/javascript" src="js/A2_I5.js"></script>88<script type="text/javascript" src="js/A3_ShowTestclasses.js"></script>89<script type="text/javascript">90var glob = {};91glob.x = '<?= json_encode($p->toJSON()) ?>';92function ini(){93 document.getElementById('file-input')94 .addEventListener('change', function (e) {importFile(e)}, false);95 glob.p = Project.fromJSON(JSON.parse(glob.x));96 //$("#o1").html(p.fold(new Foo_I2 ()));97 //var i1 = new A1_I1 ();98 //i1.morestyle = "font-size: 24px;";99 //$("#o2").html(p.fold(i1));100 //101 makeEditable ();102 glob.inj = {};103 glob.inj.i1 = new A1_I1 ();104 glob.inj.i1.keyorder["foo"] = [<?= implode(",", $i1->keyorder["foo"]) ?>];105 106 glob.inj.i3 = new A1_I3 ();107 glob.inj.i3.attrs = glob.p.attributes;108 glob.inj.i3.keyorder["foo"] = [<?= implode(",", $i1->keyorder["foo"]) ?>];109 glob.inj.i3t = new A1_I3Table ();110 //glob.inj.i3t.attrs = glob.p.attributes;111 glob.inj.i3t.keyorder["foo"] = [<?= implode(",", $i1->keyorder["foo"]) ?>];112 glob.inj.i2 = new Foo_I2 ();113 glob.inj.i5 = new A2_I5 ();114 glob.inj.itcs = new A3_ShowTestclasses ();115}116function makeEditable () {117 $('.edit').editable(function(value, settings) {118 //console.log("edit: ", value, this.dataset);119 switch (this.dataset.typ) {120 case "Value":121 var aid = this.dataset.aid;122 var pid = this.dataset.pid;123 glob.p.products[pid].values[aid].value = value;124 refreshTreeUL ();125 return value;126 case "Attribute.name":127 var aid = this.dataset.aid;128 glob.p.attributes[aid].name = value;129 refreshTreeUL ();130 return value;131 case "Attribute.type":132 var aid = this.dataset.aid;133 glob.p.attributes[aid].type = value;134 refreshTreeUL ();135 return value;136 case "Product.name":137 var pid = this.dataset.pid;138 glob.p.products[pid].name = value;139 refreshTreeUL ();140 return value;141 case "Project.name":142 glob.p.name = value;143 refreshTreeUL ();144 return value;145 case "Testclass.name":146 var tid = this.dataset.tid;147 glob.p.testclasses[tid].name = value;148 //refreshTreeUL ();149 refreshTestclassList ();150 return value;151 default:152 return "ERROR";153 }154 }, {155 placeholder: '<span style="color:red">---</span>',156 style: 'display: inline;'157 });158}159function refreshTree () {160 $("#o0").html("<h3>rendered by JS:</h3>" + glob.p.fold (glob.inj.i3));161 makeEditable ();162}163function refreshTreeUL () {164 $("#o1").html("<h3>rendered by JS:</h3>" + glob.p.fold (glob.inj.i1));165}166function refreshTreeULBig () {167 $("#o1").html("<h3>rendered by JS:</h3>" + glob.p.fold (glob.inj.i2));168}169function refreshTestclassList () {170 $("#tcs").html("<h3>rendered by JS:</h3>" + glob.p.fold (glob.inj.itcs));171}172function showTestclass (tid) {173 $("#o1").html("<h3>rendered by JS:</h3>" + glob.p.testclasses[tid].fold (glob.inj.i5));174 makeEditable ();175}176function refreshTable () {177 $("#t1").html("<h3>rendered by JS:</h3>" + glob.p.fold (glob.inj.i3t));178}179function addProduct () {180 var pid = 1 + Math.max(0, Math.max.apply(null, Object.keys(glob.p.products)));181 var p = Product.fromArgs(pid, "NEW");182 for (var aid in glob.p.attributes) {183 p.values[aid] = Value.fromArgs(aid, "");184 }185 glob.p.products[pid] = p;186 //console.log(glob.p.products[pid]);187 refreshAll ();188 //console.log(m);189}190function refreshAll () {191 refreshTreeUL ();192 refreshTestclassList ();193 refreshTable ();194 refreshTree ();195}196function importFile (e) {197 var file = e.target.files[0];198 if (!file) {199 return;200 }201 var reader = new FileReader();202 reader.onload = function(e) {203 var contents = e.target.result;204 var json = JSON.parse(contents);205 if (json) {206 var p = Project.fromJSON(json);207 if (p) {208 glob.p = p;209 refreshAll ();210 }211 }212 };213 reader.readAsText(file);214}215function exportFile () {216 var txt = JSON.stringify (glob.p.toJSON ());217 var textFileAsBlob = new Blob( [txt], {type:'text/plain'});218 var filename = "project.txt";219 var downloadLink = document.createElement("a");220 downloadLink.download = filename;221 downloadLink.innerHTML = "Download File";222 if (window.webkitURL != null) { // Chrome allows the link to be clicked without actually adding it to the DOM.223 downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);224 }225 else { // Firefox requires the link to be added to the DOM before it can be clicked.226 downloadLink.href = window.URL.createObjectURL(textFileAsBlob);227 downloadLink.onclick = function (event) {228 document.body.removeChild(event.target);229 };230 downloadLink.style.display = "none";231 document.body.appendChild(downloadLink);232 }233 downloadLink.click();234}235</script>236</body>237</html>...

Full Screen

Full Screen

A2_I5.php

Source:A2_I5.php Github

copy

Full Screen

1<?php2class A2_I5 extends F_A2 {3 public function __construct () {4 }5 6 public function foldTestclass($tid, $name, $nodes){7 return ("\n Testclass(" . $tid . ("):\n <span class=\"edit\" \n style=\"color:magenta;\"\n data-tid=\"" . $tid . ("\"\n data-typ=\"Testclass.name\"\n >" . $name . ("</span>:\n <ul>" . implode("", $nodes) . ("</ul>")))));8 }9 10 public function foldANode($aid, $weight){11 return ("\n <li><span style=\"color:#008888;\">" . $aid . (": " . $weight . ("</span>\n </li>")));12 }13 14 public function foldRNode($name, $weight, $nodes){15 return ("\n <li><span style=\"color:#009900;\">" . $name . (": " . $weight . ("</span>\n <ul>\n " . implode("", $nodes) . ("\n </ul>\n </li>"))));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 Atoum automation tests on LambdaTest cloud grid

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

Most used method in fold

Trigger testClass code on LambdaTest Cloud Grid

Execute automation tests with testClass 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