{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); ';\n\t\t$expected .= '';\n\t\t$expected .= '1';\n\t\t$expected .= '';\n\t\t$expected .= '';\n\t\t$expected .= '';\n\n\t\t$xml = new Xml($input, array('format' => 'tags'));\n\t\t$result = $xml->toString(false);\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testArraySingleSerialization method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testArraySingleSerialization"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903417,"cells":{"code":{"kind":"string","value":"function testSerializationArray() {\n\t\t$input = array(\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),\n\t\t\t\t'Industry' => array('id' => 1, 'name' => 'Financial')\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),\n\t\t\t\t'Industry' => array('id' => 2, 'name' => 'Education'),\n\t\t\t)\n\t\t);\n\t\t$expected = '1<client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry></project>';\n\n\t\t$xml = new Xml($input, array('format' => 'tags'));\n\t\t$result = $xml->toString(array('header' => false, 'cdata' => false));\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testArraySerialization method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testSerializationArray"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903418,"cells":{"code":{"kind":"string","value":"function testSerializationNestedArray() {\n\t\t$input = array(\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),\n\t\t\t\t'Industry' => array('id' => 1, 'name' => 'Financial'),\n\t\t\t\t'BusinessSolution' => array(array('id' => 6, 'name' => 'Convert Sales')),\n\t\t\t\t'MediaType' => array(\n\t\t\t\t\tarray('id' => 15, 'name' => 'Print'),\n\t\t\t\t\tarray('id' => 7, 'name' => 'Web Demo'),\n\t\t\t\t\tarray('id' => 6, 'name' => 'CD-ROM')\n\t\t\t\t)\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),\n\t\t\t\t'Industry' => array('id' => 2, 'name' => 'Education'),\n\t\t\t\t'BusinessSolution' => array(\n\t\t\t\t\tarray('id' => 4, 'name' => 'Build Relationship'),\n\t\t\t\t\tarray('id' => 6, 'name' => 'Convert Sales')\n\t\t\t\t),\n\t\t\t\t'MediaType' => array(\n\t\t\t\t\tarray('id' => 17, 'name' => 'Web'),\n\t\t\t\t\tarray('id' => 6, 'name' => 'CD-ROM')\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>15</id><name>Print</name></media_type><media_type><id>7</id><name>Web Demo</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry><business_solution><id>4</id><name>Build Relationship</name></business_solution><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>17</id><name>Web</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></project>';\n\n\t\t$xml = new Xml($input, array('format' => 'tags'));\n\t\t$result = $xml->toString(array('header' => false, 'cdata' => false));\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testNestedArraySerialization method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testSerializationNestedArray"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903419,"cells":{"code":{"kind":"string","value":"function testArraySerializationWithRoot() {\n\t\t$input = array(\n\t\t\tarray('Shirt' => array('id' => 1, 'color' => 'green')),\n\t\t\tarray('Shirt' => array('id' => 2, 'color' => 'blue')),\n\t\t);\n\t\t$expected = '<collection><shirt id=\"1\" color=\"green\" />';\n\t\t$expected .= '<shirt id=\"2\" color=\"blue\" /></collection>';\n\n\t\t$Xml = new Xml($input, array('root' => 'collection'));\n\t\t$result = $Xml->toString(array('header' => false));\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"Prove that serialization with a given root node works\nas expected.\n\n@access public\n@return void\n@link https://trac.cakephp.org/ticket/6294"},"func_name":{"kind":"string","value":"testArraySerializationWithRoot"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903420,"cells":{"code":{"kind":"string","value":"function testParsingWithNonStandardWhitespace() {\n\t\t$raw = '<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?><prices><price>1.0</price></prices>';\n\t\t$array = array('Prices' => array('price' => 1.0));\n\n\t\t$xml = new Xml($raw);\n\t\t$this->assertEqual($xml->toArray(), $array);\n\t\t$this->assertEqual($xml->__header, 'xml version=\"1.0\" encoding=\"ISO-8859-1\"');\n\n\t\t$xml = new Xml(' ' . $raw);\n\t\t$this->assertEqual($xml->toArray(), $array);\n\t\t$this->assertEqual($xml->__header, 'xml version=\"1.0\" encoding=\"ISO-8859-1\"');\n\n\t\t$xml = new Xml(\"\\n\" . $raw);\n\t\t$this->assertEqual($xml->toArray(), $array);\n\t\t$this->assertEqual($xml->__header, 'xml version=\"1.0\" encoding=\"ISO-8859-1\"');\n\t}"},"docstring":{"kind":"string","value":"Tests that XML documents with non-standard spacing (i.e. leading whitespace, whole document\non one line) still parse properly.\n\n@return void"},"func_name":{"kind":"string","value":"testParsingWithNonStandardWhitespace"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903421,"cells":{"code":{"kind":"string","value":"function testAllCData() {\n\t\t$input = array(\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => '1', 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => '1.89', 'industry_id' => '1.56', 'modified' => null, 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),\n\t\t\t\t'Industry' => array('id' => 1, 'name' => 'Financial')\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => '1', 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => '2.2', 'industry_id' => 2.2, 'modified' => '2007-11-26 14:48:36', 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),\n\t\t\t\t'Industry' => array('id' => 2, 'name' => 'Education'),\n\t\t\t)\n\t\t);\n\t\t$expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1.89</job_type_id><industry_id>1.56</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name><![CDATA[Touch Screen Kiosk]]></name></job_type><industry><id>1</id><name><![CDATA[Financial]]></name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2.2</job_type_id><industry_id>2.2</industry_id><modified><![CDATA[2007-11-26 14:48:36]]></modified><created /><style><id /><name /></style><job_type><id>2</id><name><![CDATA[Awareness Campaign]]></name></job_type><industry><id>2</id><name><![CDATA[Education]]></name></industry></project>';\n\t\t$xml = new Xml($input, array('format' => 'tags'));\n\t\t$result = $xml->toString(array('header' => false, 'cdata' => true));\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testAllCData method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testAllCData"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903422,"cells":{"code":{"kind":"string","value":"function testWhitespace() {\n\t\t$input = array(\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),\n\t\t\t\t'Industry' => array('id' => 1, 'name' => 'Financial')\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),\n\t\t\t\t'Industry' => array('id' => 2, 'name' => 'Education'),\n\t\t\t)\n\t\t);\n\t\t$expected = \"\\n\\t<project>\\n\\t\\t<id>\\n\\t\\t\\t1\\n\\t\\t</id>\\n\\t\\t<title />\\n\\t\\t<client_id>\\n\\t\\t\\t1\\n\\t\\t</client_id>\\n\\t\\t<show>\\n\\t\\t\\t1\\n\\t\\t</show>\\n\\t\\t<is_spotlight />\\n\\t\\t<style_id>\\n\\t\\t\\t0\\n\\t\\t</style_id>\\n\\t\\t<job_type_id>\\n\\t\\t\\t1\\n\\t\\t</job_type_id>\\n\\t\\t<industry_id>\\n\\t\\t\\t1\\n\\t\\t</industry_id>\\n\\t\\t<modified />\\n\\t\\t<created />\\n\\t\\t<style>\\n\\t\\t\\t<id />\\n\\t\\t\\t<name />\\n\\t\\t</style>\\n\\t\\t<job_type>\\n\\t\\t\\t<id>\\n\\t\\t\\t\\t1\\n\\t\\t\\t</id>\\n\\t\\t\\t<name>\\n\\t\\t\\t\\tTouch Screen Kiosk\\n\\t\\t\\t</name>\\n\\t\\t</job_type>\\n\\t\\t<industry>\\n\\t\\t\\t<id>\\n\\t\\t\\t\\t1\\n\\t\\t\\t</id>\\n\\t\\t\\t<name>\\n\\t\\t\\t\\tFinancial\\n\\t\\t\\t</name>\\n\\t\\t</industry>\\n\\t</project>\\n\\t<project>\\n\\t\\t<id>\\n\\t\\t\\t2\\n\\t\\t</id>\\n\\t\\t<title />\\n\\t\\t<client_id>\\n\\t\\t\\t2\\n\\t\\t</client_id>\\n\\t\\t<show>\\n\\t\\t\\t1\\n\\t\\t</show>\\n\\t\\t<is_spotlight />\\n\\t\\t<style_id>\\n\\t\\t\\t0\\n\\t\\t</style_id>\\n\\t\\t<job_type_id>\\n\\t\\t\\t2\\n\\t\\t</job_type_id>\\n\\t\\t<industry_id>\\n\\t\\t\\t2\\n\\t\\t</industry_id>\\n\\t\\t<modified>\\n\\t\\t\\t2007-11-26 14:48:36\\n\\t\\t</modified>\\n\\t\\t<created />\\n\\t\\t<style>\\n\\t\\t\\t<id />\\n\\t\\t\\t<name />\\n\\t\\t</style>\\n\\t\\t<job_type>\\n\\t\\t\\t<id>\\n\\t\\t\\t\\t2\\n\\t\\t\\t</id>\\n\\t\\t\\t<name>\\n\\t\\t\\t\\tAwareness Campaign\\n\\t\\t\\t</name>\\n\\t\\t</job_type>\\n\\t\\t<industry>\\n\\t\\t\\t<id>\\n\\t\\t\\t\\t2\\n\\t\\t\\t</id>\\n\\t\\t\\t<name>\\n\\t\\t\\t\\tEducation\\n\\t\\t\\t</name>\\n\\t\\t</industry>\\n\\t</project>\\n\";\n\n\t\t$xml = new Xml($input, array('format' => 'tags'));\n\t\t$result = $xml->toString(array('header' => false, 'cdata' => false, 'whitespace' => true));\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testWhitespace method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testWhitespace"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903423,"cells":{"code":{"kind":"string","value":"function testSetSerialization() {\n\t\t$input = array(\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),\n\t\t\t\t'Industry' => array('id' => 1, 'name' => 'Financial')\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),\n\t\t\t\t'Style' => array('id' => null, 'name' => null),\n\t\t\t\t'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),\n\t\t\t\t'Industry' => array('id' => 2, 'name' => 'Education'),\n\t\t\t)\n\t\t);\n\t\t$expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry></project>';\n\n\t\t$xml = new Xml(Set::map($input), array('format' => 'tags'));\n\t\t$result = $xml->toString(array('header' => false, 'cdata' => false));\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testSetSerialization method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testSetSerialization"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903424,"cells":{"code":{"kind":"string","value":"function testNormalizeNotAdding_name_Element() {\n\t\t$input = array(\n\t\t\t'output' => array(\n\t\t\t\t'Vouchers' => array(\n\t\t\t\t\tarray('Voucher' => array('id' => 1)),\n\t\t\t\t\tarray('Voucher' => array('id' => 2)),\n\t\t\t\t),\n\t\t\t)\n\t\t);\n\t\t$xml = new Xml($input, array('attributes' => false, 'format' => 'tags'));\n\t\t$this->assertFalse(isset($xml->children[0]->children[0]->children[1]), 'Too many children %s');\n\t\t$this->assertEqual($xml->children[0]->children[0]->children[0]->name, 'voucher');\n\t}"},"docstring":{"kind":"string","value":"ensure that normalize does not add _name_ elements that come from Set::map sometimes.\n\n@return void"},"func_name":{"kind":"string","value":"testNormalizeNotAdding_name_Element"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903425,"cells":{"code":{"kind":"string","value":"function testSimpleParsing() {\n\t\t$source = '<response><hello><![CDATA[happy world]]></hello><goodbye><![CDATA[cruel world]]></goodbye></response>';\n\t\t$xml = new Xml($source);\n\t\t$result = $xml->toString();\n\t\t$this->assertEqual($source, $result);\n\t}"},"docstring":{"kind":"string","value":"testSimpleParsing method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testSimpleParsing"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903426,"cells":{"code":{"kind":"string","value":"function testElementCollapsing() {\n\t\t$xmlDataThatFails = '<resultpackage>\n\t\t<result qid=\"46b1c46ed6208\"><![CDATA[46b1c46ed3af9]]></result>\n\t\t<result qid=\"46b1c46ed332a\"><![CDATA[]]></result>\n\t\t<result qid=\"46b1c46ed90e6\"><![CDATA[46b1c46ed69d8]]></result>\n\t\t<result qid=\"46b1c46ed71a7\"><![CDATA[46b1c46ed5a38]]></result>\n\t\t<result qid=\"46b1c46ed8146\"><![CDATA[46b1c46ed98b6]]></result>\n\t\t<result qid=\"46b1c46ed7978\"><![CDATA[]]></result>\n\t\t<result qid=\"46b1c46ed4a98\"><![CDATA[]]></result>\n\t\t<result qid=\"46b1c46ed42c8\"><![CDATA[]]></result>\n\t\t<result qid=\"46b1c46ed5268\"><![CDATA[46b1c46ed8917]]></result>\n\t\t</resultpackage>';\n\n\t\t$Xml = new Xml();\n\t\t$Xml->load('<?xml version=\"1.0\" encoding=\"UTF-8\" ?>' . $xmlDataThatFails);\n\t\t$result = $Xml->toArray(false);\n\n\t\t$this->assertTrue(is_array($result));\n\t\t$expected = array(\n\t\t\t'resultpackage' => array(\n\t\t\t\t'result' => array(\n\t\t\t\t\t0 => array(\n\t\t\t\t\t\t'value' => '46b1c46ed3af9',\n\t\t\t\t\t\t'qid' => '46b1c46ed6208'),\n\t\t\t\t\t1 => array(\n\t\t\t\t\t\t'qid' => '46b1c46ed332a'),\n\t\t\t\t\t2 => array(\n\t\t\t\t\t\t'value' => '46b1c46ed69d8',\n\t\t\t\t\t\t'qid' => '46b1c46ed90e6'),\n\t\t\t\t\t3 => array(\n\t\t\t\t\t\t'value' => '46b1c46ed5a38',\n\t\t\t\t\t\t'qid' => '46b1c46ed71a7'),\n\t\t\t\t\t4 => array(\n\t\t\t\t\t\t'value' => '46b1c46ed98b6',\n\t\t\t\t\t\t'qid' => '46b1c46ed8146'),\n\t\t\t\t\t5 => array(\n\t\t\t\t\t\t'qid' => '46b1c46ed7978'),\n\t\t\t\t\t6 => array(\n\t\t\t\t\t\t'qid' => '46b1c46ed4a98'),\n\t\t\t\t\t7 => array(\n\t\t\t\t\t\t'qid' => '46b1c46ed42c8'),\n\t\t\t\t\t8 => array(\n\t\t\t\t\t\t'value' => '46b1c46ed8917',\n\t\t\t\t\t\t'qid' => '46b1c46ed5268'),\n\t\t\t\t)\n\t\t));\n\t\t$this->assertEqual(\n\t\t\tcount($result['resultpackage']['result']), count($expected['resultpackage']['result']),\n\t\t\t'Incorrect array length %s');\n\n\t\t$this->assertFalse(\n\t\t\tisset($result['resultpackage']['result'][0][0]['qid']), 'Nested array exists, data is corrupt. %s');\n\n\t\t$this->assertEqual($result, $expected);\n\t}"},"docstring":{"kind":"string","value":"test that elements with empty tag values do not collapse and corrupt data structures\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testElementCollapsing"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903427,"cells":{"code":{"kind":"string","value":"function testCaseFoldingWithEmptyValues() {\n\t\t$filledValue = '<method name=\"set_user_settings\">\n\t\t\t<title>update user information\n\t\t\t1\n\t\t\t\n\t\t\t\t1\n\t\t\t\tvarchar(45)\n\t\t\t\n\t\t';\n\t\t$xml =& new XML($filledValue);\n\t\t$expected = array(\n\t\t\t'Method' => array(\n\t\t\t\t'name' => 'set_user_settings',\n\t\t\t\t'title' => 'update user information',\n\t\t\t\t'user' => '1',\n\t\t\t\t'User' => array(\n\t\t\t\t\t'id' => 1,\n\t\t\t\t\t'name' => 'varchar(45)',\n\t\t\t\t),\n\t\t\t)\n\t\t);\n\t\t$result = $xml->toArray();\n\t\t$this->assertEqual($result, $expected);\n\n\t\t$emptyValue ='\n\t\t\tupdate user information\n\t\t\t\n\t\t\t\n\t\t\t\t1\n\t\t\t\tvarchar(45)\n\t\t\t\n\t\t';\n\n\t\t$xml =& new XML($emptyValue);\n\t\t$expected = array(\n\t\t\t'Method' => array(\n\t\t\t\t'name' => 'set_user_settings',\n\t\t\t\t'title' => 'update user information',\n\t\t\t\t'user' => array(),\n\t\t\t\t'User' => array(\n\t\t\t\t\t'id' => 1,\n\t\t\t\t\t'name' => 'varchar(45)',\n\t\t\t\t),\n\t\t\t)\n\t\t);\n\t\t$result = $xml->toArray();\n\t\t$this->assertEqual($result, $expected);\n\t}"},"docstring":{"kind":"string","value":"test that empty values do not casefold collapse\n\n@see http://code.cakephp.org/tickets/view/8\n@return void"},"func_name":{"kind":"string","value":"testCaseFoldingWithEmptyValues"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903428,"cells":{"code":{"kind":"string","value":"function testMixedParsing() {\n\t\t$source = '';\n\t\t$xml = new Xml($source);\n\t\t$result = $xml->toString();\n\t\t$this->assertEqual($source, $result);\n\t}"},"docstring":{"kind":"string","value":"testMixedParsing method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testMixedParsing"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903429,"cells":{"code":{"kind":"string","value":"function testComplexParsing() {\n\t\t$source = '1<client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry></project></projects>';\n\t\t$xml = new Xml($source);\n\t\t$result = $xml->toString(array('cdata' => false));\n\t\t$this->assertEqual($source, $result);\n\t}"},"docstring":{"kind":"string","value":"testComplexParsing method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testComplexParsing"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903430,"cells":{"code":{"kind":"string","value":"function testNamespaceParsing() {\n\t\t$source = '<a:container xmlns:a=\"http://example.com/a\" xmlns:b=\"http://example.com/b\" xmlns:c=\"http://example.com/c\" xmlns:d=\"http://example.com/d\" xmlns:e=\"http://example.com/e\"><b:rule test=\"\"><c:result>value</c:result></b:rule><d:rule test=\"\"><e:result>value</e:result></d:rule></a:container>';\n\t\t$xml = new Xml($source);\n\n\t\t$result = $xml->toString(array('cdata' => false));\n\t\t$this->assertEqual($source, $result);\n\n\t\t$children = $xml->children('container');\n\t\t$this->assertEqual($children[0]->namespace, 'a');\n\n\t\t$children = $children[0]->children('rule');\n\t\t$this->assertEqual($children[0]->namespace, 'b');\n\t}"},"docstring":{"kind":"string","value":"testNamespaceParsing method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testNamespaceParsing"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903431,"cells":{"code":{"kind":"string","value":"function testNamespaces() {\n\t\t$source = '<a:container xmlns:a=\"http://example.com/a\" xmlns:b=\"http://example.com/b\" xmlns:c=\"http://example.com/c\" xmlns:d=\"http://example.com/d\" xmlns:e=\"http://example.com/e\"><b:rule test=\"\"><c:result>value</c:result></b:rule><d:rule test=\"\"><e:result>value</e:result></d:rule></a:container>';\n\t\t$xml = new Xml($source);\n\n\t\t$expects = '<a:container xmlns:a=\"http://example.com/a\" xmlns:b=\"http://example.com/b\" xmlns:c=\"http://example.com/c\" xmlns:d=\"http://example.com/d\" xmlns:e=\"http://example.com/e\" xmlns:f=\"http://example.com/f\"><b:rule test=\"\"><c:result>value</c:result></b:rule><d:rule test=\"\"><e:result>value</e:result></d:rule></a:container>';\n\n\t\t$_xml =& XmlManager::getInstance();\n\t\t$xml->addNamespace('f', 'http://example.com/f');\n\t\t$result = $xml->toString(array('cdata' => false));\n\t\t$this->assertEqual($expects, $result);\n\t}"},"docstring":{"kind":"string","value":"testNamespaces method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testNamespaces"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903432,"cells":{"code":{"kind":"string","value":"function testEscapeCharSerialization() {\n\t\t$xml = new Xml(array('text' => 'JavaScript & DHTML'), array('attributes' => false, 'format' => 'attributes'));\n\n\t\t$result = $xml->toString(false);\n\t\t$expected = '<std_class text=\"JavaScript &amp; DHTML\" />';\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testEscapeCharSerialization method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testEscapeCharSerialization"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903433,"cells":{"code":{"kind":"string","value":"function testCompleteEscapeCharSerialization() {\n\t\t$xml = new Xml(array('text' => '<>&\"\\''), array('attributes' => false, 'format' => 'attributes'));\n\n\t\t$result = $xml->toString(false);\n\t\t$expected = '<std_class text=\"&lt;&gt;&amp;&quot;&#039;\" />';\n\t\t$this->assertEqual($expected, $result);\n\t}"},"docstring":{"kind":"string","value":"testCompleteEscapeCharSerialization method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testCompleteEscapeCharSerialization"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903434,"cells":{"code":{"kind":"string","value":"function testToArray() {\n\t\tApp::import('Set');\n\t\t$string = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n\t\t<rss version=\"2.0\">\n\t\t<channel>\n\t\t\t<title>Cake PHP Google Group\n\t\t\thttp://groups.google.com/group/cake-php\n\t\t\tSearch this group before posting anything. There are over 20,000 posts and it&amp;#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.\n\t\t\ten\n\t\t\t\n\t\t\t\tconstructng result array when using findall\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f\n\t\t\t\ti&#39;m using cakephp to construct a logical data model array that will be &lt;br&gt; passed to a flex app. I have the following model association: &lt;br&gt; ServiceDay-&amp;gt;(hasMany)ServiceTi me-&amp;gt;(hasMany)ServiceTimePrice. So what &lt;br&gt; the current output from my findall is something like this example: &lt;br&gt; &lt;p&gt;Array( &lt;br&gt; [0] =&amp;gt; Array(\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f\n\t\t\t\tbmil...@gmail.com(bpscrugs)\n\t\t\t\tFri, 28 Dec 2007 00:44:14 UT\n\t\t\t\n\t\t\t\n\t\t\t\tRe: share views between actions?\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/8b350d898707dad8\n\t\t\t\tThen perhaps you might do us all a favour and refrain from replying to &lt;br&gt; things you do not understand. That goes especially for asinine comments. &lt;br&gt; Indeed. &lt;br&gt; To sum up: &lt;br&gt; No comment. &lt;br&gt; In my day, a simple &amp;quot;RTFM&amp;quot; would suffice. I&#39;ll keep in mind to ignore any &lt;br&gt; further responses from you. &lt;br&gt; You (and I) were referring to the *online documentation*, not other\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/8b350d898707dad8\n\t\t\t\tsubtropolis.z...@gmail.com(subtropolis zijn)\n\t\t\t\tFri, 28 Dec 2007 00:45:01 UT\n\t\t\t\n\t\t\n\t\t';\n\t\t$xml = new Xml($string);\n\t\t$result = $xml->toArray();\n\t\t$expected = array('Rss' => array(\n\t\t\t'version' => '2.0',\n\t\t\t'Channel' => array(\n\t\t\t\t'title' => 'Cake PHP Google Group',\n\t\t\t\t'link' => 'http://groups.google.com/group/cake-php',\n\t\t\t\t'description' => 'Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.',\n\t\t\t\t'language' => 'en',\n\t\t\t\t'Item' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'title' => 'constructng result array when using findall',\n\t\t\t\t\t\t'link' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f',\n\t\t\t\t\t\t'description' => \"i'm using cakephp to construct a logical data model array that will be
passed to a flex app. I have the following model association:
ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what
the current output from my findall is something like this example:

Array(
[0] =&gt; Array(\",\n\t\t\t\t\t\t'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f'),\n\t\t\t\t\t\t'author' => 'bmil...@gmail.com(bpscrugs)',\n\t\t\t\t\t\t'pubDate' => 'Fri, 28 Dec 2007 00:44:14 UT',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'title' => 'Re: share views between actions?',\n\t\t\t\t\t\t'link' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8',\n\t\t\t\t\t\t'description' => 'Then perhaps you might do us all a favour and refrain from replying to
things you do not understand. That goes especially for asinine comments.
Indeed.
To sum up:
No comment.
In my day, a simple &quot;RTFM&quot; would suffice. I\\'ll keep in mind to ignore any
further responses from you.
You (and I) were referring to the *online documentation*, not other',\n\t\t\t\t\t\t'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8'),\n\t\t\t\t\t\t'author' => 'subtropolis.z...@gmail.com(subtropolis zijn)',\n\t\t\t\t\t\t'pubDate' => 'Fri, 28 Dec 2007 00:45:01 UT'\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t));\n\t\t$this->assertEqual($result, $expected);\n\n\t\t$string ='';\n\t\t$xml = new Xml($string);\n\t\t$result = $xml->toArray();\n\t\t$expected = array('Data' => array('Post' => array('title' => 'Title of this post', 'description' => 'cool')));\n\t\t$this->assertEqual($result, $expected);\n\n\t\t$xml = new Xml('An example of a correctly reversed XMLNode');\n\t\t$result = Set::reverse($xml);\n\t\t$expected = array(\n\t\t\t'Example' => array(\n\t\t\t\t'Item' => array(\n\t\t\t\t\t'title' => 'An example of a correctly reversed XMLNode',\n\t\t\t\t\t'desc' => array(),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\n\t\t$xml = new Xml('title1title2');\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'Example' => array(\n\t\t\t\t'Item' => array(\n\t\t\t\t\t'attr' => '123',\n\t\t\t\t\t'Titles' => array(\n\t\t\t\t\t\t'Title' => array('title1', 'title2')\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\n\t\t$xml = new Xml('listtextforitems');\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'Example' => array(\n\t\t\t\t'attr' => 'ex_attr',\n\t\t\t\t'Item' => array(\n\t\t\t\t\t'attr' => '123',\n\t\t\t\t\t'titles' => 'list',\n\t\t\t\t\t'value' => 'textforitems'\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\n\t\t$xml = new Xml('listtextforitems');\n\t\t$example = $xml->child('example');\n\t\t$item = $example->child('item');\n\t\t$result = $item->toArray();\n\n\t\t$expected = array(\n\t\t\t'attr' => '123',\n\t\t\t'titles' => 'list',\n\t\t\t'value' => 'textforitems'\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\n\t\t$string = '\n\t\t\n\t\t\n\t\t\tCake PHP Google Group\n\t\t\thttp://groups.google.com/group/cake-php\n\t\t\tSearch this group before posting anything. There are over 20,000 posts and it&amp;#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.\n\t\t\ten\n\t\t\t\n\t\t\t\tconstructng result array when using findall\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f\n\t\t\t\ti&#39;m using cakephp to construct a logical data model array that will be &lt;br&gt; passed to a flex app. I have the following model association: &lt;br&gt; ServiceDay-&amp;gt;(hasMany)ServiceTi me-&amp;gt;(hasMany)ServiceTimePrice. So what &lt;br&gt; the current output from my findall is something like this example: &lt;br&gt; &lt;p&gt;Array( &lt;br&gt; [0] =&amp;gt; Array(\n\t\t\t\tcakephp\n\t\t\t\t\n\t\t\t\t\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f\n\t\t\t\tbmil...@gmail.com(bpscrugs)\n\t\t\t\tFri, 28 Dec 2007 00:44:14 UT\n\t\t\t\n\t\t\t\n\t\t\t\tRe: share views between actions?\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/8b350d898707dad8\n\t\t\t\tThen perhaps you might do us all a favour and refrain from replying to &lt;br&gt; things you do not understand. That goes especially for asinine comments. &lt;br&gt; Indeed. &lt;br&gt; To sum up: &lt;br&gt; No comment. &lt;br&gt; In my day, a simple &amp;quot;RTFM&amp;quot; would suffice. I&#39;ll keep in mind to ignore any &lt;br&gt; further responses from you. &lt;br&gt; You (and I) were referring to the *online documentation*, not other\n\t\t\t\tcakephp\n\t\t\t\t\n\t\t\t\t\n\t\t\t\thttp://groups.google.com/group/cake-php/msg/8b350d898707dad8\n\t\t\t\tsubtropolis.z...@gmail.com(subtropolis zijn)\n\t\t\t\tFri, 28 Dec 2007 00:45:01 UT\n\t\t\t\n\t\t\n\t\t';\n\n\t\t$xml = new Xml($string);\n\t\t$result = $xml->toArray();\n\n\t\t$expected = array('Rss' => array(\n\t\t\t'version' => '2.0',\n\t\t\t'Channel' => array(\n\t\t\t\t'title' => 'Cake PHP Google Group',\n\t\t\t\t'link' => 'http://groups.google.com/group/cake-php',\n\t\t\t\t'description' => 'Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.',\n\t\t\t\t'language' => 'en',\n\t\t\t\t'Item' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'title' => 'constructng result array when using findall',\n\t\t\t\t\t\t'link' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f',\n\t\t\t\t\t\t'description' => \"i'm using cakephp to construct a logical data model array that will be
passed to a flex app. I have the following model association:
ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what
the current output from my findall is something like this example:

Array(
[0] =&gt; Array(\",\n\t\t\t\t\t\t'creator' => 'cakephp',\n\t\t\t\t\t\t'Category' => array('cakephp', 'model'),\n\t\t\t\t\t\t'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f'),\n\t\t\t\t\t\t'author' => 'bmil...@gmail.com(bpscrugs)',\n\t\t\t\t\t\t'pubDate' => 'Fri, 28 Dec 2007 00:44:14 UT',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'title' => 'Re: share views between actions?',\n\t\t\t\t\t\t'link' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8',\n\t\t\t\t\t\t'description' => 'Then perhaps you might do us all a favour and refrain from replying to
things you do not understand. That goes especially for asinine comments.
Indeed.
To sum up:
No comment.
In my day, a simple &quot;RTFM&quot; would suffice. I\\'ll keep in mind to ignore any
further responses from you.
You (and I) were referring to the *online documentation*, not other',\n\t\t\t\t\t\t'creator' => 'cakephp',\n\t\t\t\t\t\t'Category' => array('cakephp', 'model'),\n\t\t\t\t\t\t'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8'),\n\t\t\t\t\t\t'author' => 'subtropolis.z...@gmail.com(subtropolis zijn)',\n\t\t\t\t\t\t'pubDate' => 'Fri, 28 Dec 2007 00:45:01 UT'\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t));\n\t\t$this->assertEqual($result, $expected);\n\n\t\t$text = \"\n\t\t \n\t\t \n\t\t 1\n\t\t 2\n\t\t 3\n\t\t 4\n\t\t \n\t\t \";\n\t\t$xml = new Xml($text);\n\t\t$result = $xml->toArray();\n\n\t\t$expected = array('Course' => array(\n\t\t\t'Comps' => array(\n\t\t\t\t'Comp' => array(\n\t\t\t\t\t1, 2, 3, 4\n\t\t\t\t)\n\t\t\t)\n\t\t));\n\n\t\t$this->assertEqual($result, $expected);\n\n\t\t$text = '\n\t\t\n\t\t\n\t\t\txri://$xrds*simple\n\t\t\t2008-04-13T07:34:58Z\n\t\t\t\n\t\t\t\thttp://oauth.net/core/1.0/endpoint/authorize\n\t\t\t\thttp://oauth.net/core/1.0/parameters/auth-header\n\t\t\t\thttp://oauth.net/core/1.0/parameters/uri-query\n\t\t\t\thttps://ma.gnolia.com/oauth/authorize\n\t\t\t\thttp://ma.gnolia.com/oauth/authorize\n\t\t\t\n\t\t\n\t\t\n\t\t\txri://$xrds*simple\n\t\t\t\t\n\t\t\t\t\thttp://oauth.net/discovery/1.0\n\t\t\t\t\t#oauth\n\t\t\t\t\n\t\t\n\t\t';\n\n\t\t$xml = new Xml($text);\n\t\t$result = $xml->toArray();\n\n\t\t$expected = array('XRDS' => array(\n\t\t\t'xmlns' => 'xri://$xrds',\n\t\t\t'XRD' => array(\n\t\t\t\tarray(\n\t\t\t\t\t'xml:id' => 'oauth',\n\t\t\t\t\t'xmlns' => 'xri://$XRD*($v*2.0)',\n\t\t\t\t\t'version' => '2.0',\n\t\t\t\t\t'Type' => 'xri://$xrds*simple',\n\t\t\t\t\t'Expires' => '2008-04-13T07:34:58Z',\n\t\t\t\t\t'Service' => array(\n\t\t\t\t\t\t'Type' => array(\n\t\t\t\t\t\t\t'http://oauth.net/core/1.0/endpoint/authorize',\n\t\t\t\t\t\t\t'http://oauth.net/core/1.0/parameters/auth-header',\n\t\t\t\t\t\t\t'http://oauth.net/core/1.0/parameters/uri-query'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'URI' => array(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'value' => 'https://ma.gnolia.com/oauth/authorize',\n\t\t\t\t\t\t\t\t'priority' => '10',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'value' => 'http://ma.gnolia.com/oauth/authorize',\n\t\t\t\t\t\t\t\t'priority' => '20'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tarray(\n\t\t\t\t\t'xmlns' => 'xri://$XRD*($v*2.0)',\n\t\t\t\t\t'version' => '2.0',\n\t\t\t\t\t'Type' => 'xri://$xrds*simple',\n\t\t\t\t\t'Service' => array(\n\t\t\t\t\t\t'priority' => '10',\n\t\t\t\t\t\t'Type' => 'http://oauth.net/discovery/1.0',\n\t\t\t\t\t\t'URI' => '#oauth'\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t));\n\t\t$this->assertEqual($result, $expected);\n\n\t\t$text = '\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t';\n\t\t$xml = new Xml($text);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'Root' => array(\n\t\t\t\t'Child' => array(\n\t\t\t\t\tarray('id' => 1, 'other' => 1),\n\t\t\t\t\tarray('id' => 2, 'other' => 1),\n\t\t\t\t\tarray('id' => 3, 'other' => 1),\n\t\t\t\t\tarray('id' => 4, 'other' => 1),\n\t\t\t\t\tarray('id' => 5, 'other' => 1)\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertEqual($result, $expected);\n\n\t\t$text = '

';\n\t\t$xml = new Xml($text);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t 'Main' => array(\n\t\t 'First' => array(\n\t\t array('label' => 'first type node 1'),\n\t\t array('label' => 'first type node 2')\n\t\t ),\n\t\t 'Second' => array('label'=>'second type node')\n\t\t )\n\t\t);\n\t\t$this->assertIdentical($result,$expected);\n\n\t\t$text = '
';\n\t\t$xml = new Xml($text);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t 'Main' => array(\n\t\t 'First' => array(\n\t\t array('label' => 'first type node 1'),\n\t\t array('label' => 'first type node 2')\n\t\t ),\n\t\t 'Second' => array('label'=>'second type node'),\n\t\t\t\t'Collection' => array(\n\t\t\t\t\t'Fifth' => array('label' => 'fifth type node'),\n\t\t\t\t\t'Third' => array(\n\t\t\t\t\t\tarray('label' => 'third type node 1'),\n\t\t\t\t\t\tarray('label' => 'third type node 2'),\n\t\t\t\t\t\tarray('label' => 'third type node 3'),\n\t\t\t\t\t),\n\t\t\t\t\t'Fourth' => array('label' => 'fourth type node'),\n\t\t\t\t)\n\t\t )\n\t\t);\n\t\t$this->assertIdentical($result,$expected);\n\t}"},"docstring":{"kind":"string","value":"testToArray method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testToArray"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903435,"cells":{"code":{"kind":"string","value":"function testAppend() {\n\t\t$parentNode = new XmlNode('ourParentNode');\n\t\t$parentNode->append( new XmlNode('ourChildNode'));\n\t\t$first =& $parentNode->first();\n\t\t$this->assertEqual($first->name, 'ourChildNode');\n\n\t\t$string = 'ourChildNode';\n\t\t$parentNode = new XmlNode('ourParentNode');\n\t\t$parentNode->append($string);\n\t\t$last =& $parentNode->last();\n\t\t$this->assertEqual($last->name, 'ourChildNode');\n\n\t\t$this->expectError();\n\t\t$parentNode->append($parentNode);\n\t}"},"docstring":{"kind":"string","value":"testAppend method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testAppend"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903436,"cells":{"code":{"kind":"string","value":"function testNamespacing() {\n\t\t$node = new Xml('');\n\t\t$node->addNamespace('cake', 'http://cakephp.org');\n\t\t$this->assertEqual($node->toString(), '');\n\n\t\t$this->assertTrue($node->removeNamespace('cake'));\n\t\t$this->assertEqual($node->toString(), '');\n\n\n\t\t$node = new Xml('');\n\t\t$this->assertTrue($node->removeNamespace('cake'));\n\t\t$this->assertEqual($node->toString(), '');\n\n\t\t$node->addNamespace('cake', 'http://cakephp.org');\n\t\t$this->assertEqual($node->toString(), '');\n\t}"},"docstring":{"kind":"string","value":"testNamespacing method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testNamespacing"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903437,"cells":{"code":{"kind":"string","value":"function testCamelize() {\n\t\t$xmlString = 'examples.getStateName' .\n\t\t\t'41';\n\n\t\t$Xml = new Xml($xmlString);\n\t\t$expected = array(\n\t\t\t'methodCall' => array(\n\t\t\t\t'methodName' => 'examples.getStateName',\n\t\t\t\t\t'params' => array(\n\t\t\t\t\t\t'param' => array('value' => array('i4' => 41)))));\n\t\t$this->assertEqual($expected, $Xml->toArray(false));\n\n\t\t$Xml = new Xml($xmlString);\n\t\t$expected = array(\n\t\t\t'MethodCall' => array(\n\t\t\t\t'methodName' => 'examples.getStateName',\n\t\t\t\t\t'Params' => array(\n\t\t\t\t\t\t'Param' => array('Value' => array('i4' => 41)))));\n\t\t$this->assertEqual($expected, $Xml->toArray());\n\t}"},"docstring":{"kind":"string","value":"testCamelize method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testCamelize"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903438,"cells":{"code":{"kind":"string","value":"function testNumericDataHandling() {\n\t\t$data = '012345';\n\n\t\t$node = new Xml();\n\t\t$node->load($data);\n\t\t$node->parse();\n\n\t\t$result = $node->first();\n\t\t$result = $result->children(\"data\");\n\n\t\t$result = $result[0]->first();\n\t\t$this->assertEqual($result->value, '012345');\n\t}"},"docstring":{"kind":"string","value":"testNumericDataHandling method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testNumericDataHandling"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903439,"cells":{"code":{"kind":"string","value":"function testMemoryLeakInConstructor() {\n\t\tif ($this->skipIf(!function_exists('memory_get_usage'), 'Cannot test memory leaks without memory_get_usage')) {\n\t\t\treturn;\n\t\t}\n\t\t$data = 'TEST';\n\t\t$start = memory_get_usage();\n\t\tfor ($i = 0; $i <= 300; $i++) {\n\t\t\t$test =& new XML($data);\n\t\t\t$test->__destruct();\n\t\t\tunset($test);\n\t\t}\n\t\t$end = memory_get_usage();\n\t\t$this->assertWithinMargin($start, $end, 3600, 'Memory leaked %s');\n\t}"},"docstring":{"kind":"string","value":"test that creating an xml object does not leak memory\n\n@return void"},"func_name":{"kind":"string","value":"testMemoryLeakInConstructor"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903440,"cells":{"code":{"kind":"string","value":"function testToArrayAlternate() {\n\t\t$sXml = \n\t\t'\n\t\t \tA\n \t\tAAAB\n\t \t\tC\n\t\t';\n\t\t$xml = new Xml($sXml);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'T1' => array(\n\t\t\t\t'T2' => array(\n\t\t\t\t\t'A',\n\t\t\t\t\tarray('t3' => 'AAA', 'value' => 'B'),\n\t\t\t\t\t'C'\n\t\t\t)\n\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t$result = $xml->toArray(false);\n\t\t$expected = array(\n\t\t\t't1' => array(\n\t\t\t\t't2' => array(\n\t\t\t\t\t'A',\n\t\t\t\t\tarray('t3' => 'AAA', 'value' => 'B'),\n\t\t\t\t\t'C'\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t\n\t\t$sXml = \n\t\t'\n\t\t \tA\n\t \t\tB\n \t\t\n\t \tCCC\n\t \t\n\t\t';\n\t\t$xml = new Xml($sXml);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'T1' => array(\n\t\t\t\t'T2' => array(\n\t\t\t\t\t'A',\n\t\t\t\t\t'B',\n\t\t\t\t\tarray('t3' => 'CCC'),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t$result = $xml->toArray(false);\n\t\t$expected = array(\n\t\t\t't1' => array(\n\t\t\t\t't2' => array(\n\t\t\t\t\t'A',\n\t\t\t\t\t'B',\n\t\t\t\t\tarray('t3' => 'CCC'),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t\n\t\t$sXml = \n\t\t'\n\t\t A\n\t\t \n\t\t C\n\t\t';\n\t\t$xml = new Xml($sXml);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'T1' => array(\n\t\t\t\t'T2' => array(\n\t\t\t\t\t'A',\n\t\t\t\t\tarray(),\n\t\t\t\t\t'C'\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\n\t\t$result = $xml->toArray(false);\n\t\t$expected = array(\n\t\t\t't1' => array(\n\t\t\t\t't2' => array(\n\t\t\t\t\t'A',\n\t\t\t\t\tarray(),\n\t\t\t\t\t'C'\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t\n\t\t$sXml = \n\t\t'\n \n \n \n \n \n \n \n \n \n \n \n \n';\n\t\t$xml = new Xml($sXml);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'Stuff' => array(\n\t\t\t\t'Foo' => array(\n\t\t\t\t\tarray('name' => 'abc-16', 'profile-id' => 'Default'),\n\t\t\t\t\tarray('name' => 'abc-17', 'profile-id' => 'Default', \n\t\t\t\t\t\t'Bar' => array('id' => 'HelloWorld')),\n\t\t\t\t\tarray('name' => 'abc-asdf', 'profile-id' => 'Default'),\n\t\t\t\t\tarray('name' => 'cba-1A', 'profile-id' => 'Default', \n\t\t\t\t\t\t'Bar' => array('id' => 'Baz')),\n\t\t\t\t\tarray('name' => 'cba-2A', 'profile-id' => 'Default', \n\t\t\t\t\t\t'Bar' => array('id' => 'Baz')),\n\t\t\t\t\tarray('name' => 'qa', 'profile-id' => 'Default'),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t$result = $xml->toArray(false);\n\t\t$expected = array(\n\t\t\t'stuff' => array(\n\t\t\t\t'foo' => array(\n\t\t\t\t\tarray('name' => 'abc-16', 'profile-id' => 'Default'),\n\t\t\t\t\tarray('name' => 'abc-17', 'profile-id' => 'Default', \n\t\t\t\t\t\t'bar' => array('id' => 'HelloWorld')),\n\t\t\t\t\tarray('name' => 'abc-asdf', 'profile-id' => 'Default'),\n\t\t\t\t\tarray('name' => 'cba-1A', 'profile-id' => 'Default', \n\t\t\t\t\t\t'bar' => array('id' => 'Baz')),\n\t\t\t\t\tarray('name' => 'cba-2A', 'profile-id' => 'Default', \n\t\t\t\t\t\t'bar' => array('id' => 'Baz')),\n\t\t\t\t\tarray('name' => 'qa', 'profile-id' => 'Default'),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t\n\t\t\n\t\t$sXml = \n\t\t'\n \n \n \n';\n\t\t$xml = new Xml($sXml);\n\t\t$result = $xml->toArray();\n\t\t$expected = array(\n\t\t\t'Root' => array(\n\t\t\t\t'Node' => array(\n\t\t\t\t\tarray('name' => 'first'),\n\t\t\t\t\tarray('name' => 'second', \n\t\t\t\t\t\t'Subnode' => array(\n\t\t\t\t\t\t\tarray('name' => 'first sub'), \n\t\t\t\t\t\t\tarray('name' => 'second sub'))),\n\t\t\t\t\tarray('name' => 'third'),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t\t\n\t\t$result = $xml->toArray(false);\n\t\t$expected = array(\n\t\t\t'root' => array(\n\t\t\t\t'node' => array(\n\t\t\t\t\tarray('name' => 'first'),\n\t\t\t\t\tarray('name' => 'second', \n\t\t\t\t\t\t'subnode' => array(\n\t\t\t\t\t\t\tarray('name' => 'first sub'), \n\t\t\t\t\t\t\tarray('name' => 'second sub'))),\n\t\t\t\t\tarray('name' => 'third'),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t$this->assertIdentical($result, $expected);\n\t}"},"docstring":{"kind":"string","value":"Test toArray with alternate inputs.\n\n@return void"},"func_name":{"kind":"string","value":"testToArrayAlternate"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/xml.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903441,"cells":{"code":{"kind":"string","value":"function skip() {\n\t\t$skip = true;\n\t\tif (function_exists('apc_store')) {\n\t\t\t$skip = false;\n\t\t}\n\t\t$this->skipIf($skip, '%s Apc is not installed or configured properly');\n\t}"},"docstring":{"kind":"string","value":"skip method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"skip"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903442,"cells":{"code":{"kind":"string","value":"function setUp() {\n\t\t$this->_cacheDisable = Configure::read('Cache.disable');\n\t\tConfigure::write('Cache.disable', false);\n\t\tCache::config('apc', array('engine' => 'Apc', 'prefix' => 'cake_'));\n\t}"},"docstring":{"kind":"string","value":"setUp method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"setUp"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903443,"cells":{"code":{"kind":"string","value":"function tearDown() {\n\t\tConfigure::write('Cache.disable', $this->_cacheDisable);\n\t\tCache::drop('apc');\n\t\tCache::config('default');\n\t}"},"docstring":{"kind":"string","value":"tearDown method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"tearDown"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903444,"cells":{"code":{"kind":"string","value":"function testReadAndWriteCache() {\n\t\tCache::set(array('duration' => 1));\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = '';\n\t\t$this->assertEqual($result, $expecting);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('test', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = $data;\n\t\t$this->assertEqual($result, $expecting);\n\n\t\tCache::delete('test');\n\t}"},"docstring":{"kind":"string","value":"testReadAndWriteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testReadAndWriteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903445,"cells":{"code":{"kind":"string","value":"function testReadWriteDurationZero() {\n\t\tCache::config('apc', array('engine' => 'Apc', 'duration' => 0, 'prefix' => 'cake_'));\n\t\tCache::write('zero', 'Should save', 'apc');\n\t\tsleep(1);\n\n\t\t$result = Cache::read('zero', 'apc');\n\t\t$this->assertEqual('Should save', $result);\n\t}"},"docstring":{"kind":"string","value":"Writing cache entries with duration = 0 (forever) should work.\n\n@return void"},"func_name":{"kind":"string","value":"testReadWriteDurationZero"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903446,"cells":{"code":{"kind":"string","value":"function testExpiry() {\n\t\tCache::set(array('duration' => 1));\n\n\t\t$result = Cache::read('test');\n\t\t$this->assertFalse($result);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\n\t\tCache::set(array('duration' => 1));\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\t}"},"docstring":{"kind":"string","value":"testExpiry method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testExpiry"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903447,"cells":{"code":{"kind":"string","value":"function testDeleteCache() {\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('delete_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::delete('delete_test');\n\t\t$this->assertTrue($result);\n\t}"},"docstring":{"kind":"string","value":"testDeleteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testDeleteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903448,"cells":{"code":{"kind":"string","value":"function testDecrement() {\n\t\tif ($this->skipIf(!function_exists('apc_dec'), 'No apc_dec() function, cannot test decrement() %s')) {\n\t\t\treturn;\n\t\t}\n\t\t$result = Cache::write('test_decrement', 5);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::decrement('test_decrement');\n\t\t$this->assertEqual(4, $result);\n\n\t\t$result = Cache::read('test_decrement');\n\t\t$this->assertEqual(4, $result);\n\n\t\t$result = Cache::decrement('test_decrement', 2);\n\t\t$this->assertEqual(2, $result);\n\n\t\t$result = Cache::read('test_decrement');\n\t\t$this->assertEqual(2, $result);\n\t\t\n\t}"},"docstring":{"kind":"string","value":"testDecrement method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testDecrement"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903449,"cells":{"code":{"kind":"string","value":"function testIncrement() {\n\t\tif ($this->skipIf(!function_exists('apc_inc'), 'No apc_inc() function, cannot test increment() %s')) {\n\t\t\treturn;\n\t\t}\n\t\t$result = Cache::write('test_increment', 5);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::increment('test_increment');\n\t\t$this->assertEqual(6, $result);\n\n\t\t$result = Cache::read('test_increment');\n\t\t$this->assertEqual(6, $result);\n\n\t\t$result = Cache::increment('test_increment', 2);\n\t\t$this->assertEqual(8, $result);\n\n\t\t$result = Cache::read('test_increment');\n\t\t$this->assertEqual(8, $result);\n\t}"},"docstring":{"kind":"string","value":"testIncrement method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testIncrement"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/apc.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903450,"cells":{"code":{"kind":"string","value":"function startCase() {\n\t\t$this->_cacheDisable = Configure::read('Cache.disable');\n\t\t$this->_cacheConfig = Cache::config('default');\n\t\tConfigure::write('Cache.disable', false);\n\t\tCache::config('default', array('engine' => 'File', 'path' => CACHE));\n\t}"},"docstring":{"kind":"string","value":"startCase method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"startCase"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903451,"cells":{"code":{"kind":"string","value":"function endCase() {\n\t\tConfigure::write('Cache.disable', $this->_cacheDisable);\n\t\tCache::config('default', $this->_cacheConfig['settings']);\n\t}"},"docstring":{"kind":"string","value":"endCase method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"endCase"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903452,"cells":{"code":{"kind":"string","value":"function testCacheDirChange() {\n\t\t$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'sessions'));\n\t\t$this->assertEqual($result['settings'], Cache::settings('sessions'));\n\n\t\t$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'tests'));\n\t\t$this->assertEqual($result['settings'], Cache::settings('sessions'));\n\t\t$this->assertNotEqual($result['settings'], Cache::settings('default'));\n\t}"},"docstring":{"kind":"string","value":"testCacheDirChange method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testCacheDirChange"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903453,"cells":{"code":{"kind":"string","value":"function testReadAndWriteCache() {\n\t\tCache::config('default');\n\n\t\t$result = Cache::write(null, 'here');\n\t\t$this->assertFalse($result);\n\n\t\tCache::set(array('duration' => 1));\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = '';\n\t\t$this->assertEqual($result, $expecting);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('test', $data);\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_test'));\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = $data;\n\t\t$this->assertEqual($result, $expecting);\n\n\t\tCache::delete('test');\n\t}"},"docstring":{"kind":"string","value":"testReadAndWriteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testReadAndWriteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903454,"cells":{"code":{"kind":"string","value":"function testExpiry() {\n\t\tCache::set(array('duration' => 1));\n\n\t\t$result = Cache::read('test');\n\t\t$this->assertFalse($result);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\n\t\tCache::set(array('duration' => \"+1 second\"));\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\t}"},"docstring":{"kind":"string","value":"testExpiry method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testExpiry"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903455,"cells":{"code":{"kind":"string","value":"function testDeleteCache() {\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('delete_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::delete('delete_test');\n\t\t$this->assertTrue($result);\n\t\t$this->assertFalse(file_exists(TMP . 'tests' . DS . 'delete_test'));\n\n\t\t$result = Cache::delete('delete_test');\n\t\t$this->assertFalse($result);\n\t}"},"docstring":{"kind":"string","value":"testDeleteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testDeleteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903456,"cells":{"code":{"kind":"string","value":"function testSerialize() {\n\t\tCache::config('default', array('engine' => 'File', 'serialize' => true));\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$write = Cache::write('serialize_test', $data);\n\t\t$this->assertTrue($write);\n\n\t\tCache::config('default', array('serialize' => false));\n\t\t$read = Cache::read('serialize_test');\n\n\t\t$newread = Cache::read('serialize_test');\n\n\t\t$delete = Cache::delete('serialize_test');\n\n\t\t$this->assertIdentical($read, serialize($data));\n\n\t\t$this->assertIdentical(unserialize($newread), $data);\n\t}"},"docstring":{"kind":"string","value":"testSerialize method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testSerialize"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903457,"cells":{"code":{"kind":"string","value":"function testClear() {\n\t\tCache::config('default', array('engine' => 'File', 'duration' => 1));\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$write = Cache::write('serialize_test1', $data);\n\t\t$write = Cache::write('serialize_test2', $data);\n\t\t$write = Cache::write('serialize_test3', $data);\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));\n\t\tsleep(2);\n\t\t$result = Cache::clear(true);\n\t\t$this->assertTrue($result);\n\t\t$this->assertFalse(file_exists(CACHE . 'cake_serialize_test1'));\n\t\t$this->assertFalse(file_exists(CACHE . 'cake_serialize_test2'));\n\t\t$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$write = Cache::write('serialize_test1', $data);\n\t\t$write = Cache::write('serialize_test2', $data);\n\t\t$write = Cache::write('serialize_test3', $data);\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));\n\n\t\t$result = Cache::clear();\n\t\t$this->assertTrue($result);\n\t\t$this->assertFalse(file_exists(CACHE . 'cake_serialize_test1'));\n\t\t$this->assertFalse(file_exists(CACHE . 'cake_serialize_test2'));\n\t\t$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));\n\n\t\tCache::config('default', array('engine' => 'File', 'path' => CACHE . 'views'));\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$write = Cache::write('controller_view_1', $data);\n\t\t$write = Cache::write('controller_view_2', $data);\n\t\t$write = Cache::write('controller_view_3', $data);\n\t\t$write = Cache::write('controller_view_10', $data);\n\t\t$write = Cache::write('controller_view_11', $data);\n\t\t$write = Cache::write('controller_view_12', $data);\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));\n\n\t\tclearCache('controller_view_1', 'views', '');\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));\n\n\t\tclearCache('controller_view', 'views', '');\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));\n\n\t\t$write = Cache::write('controller_view_1', $data);\n\t\t$write = Cache::write('controller_view_2', $data);\n\t\t$write = Cache::write('controller_view_3', $data);\n\t\t$write = Cache::write('controller_view_10', $data);\n\t\t$write = Cache::write('controller_view_11', $data);\n\t\t$write = Cache::write('controller_view_12', $data);\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));\n\n\t\tclearCache(array('controller_view_2', 'controller_view_11', 'controller_view_12'), 'views', '');\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));\n\t\t$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));\n\t\t$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));\n\n\t\tclearCache('controller_view');\n\n\t\tCache::config('default', array('engine' => 'File', 'path' => CACHE));\n\t}"},"docstring":{"kind":"string","value":"testClear method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testClear"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903458,"cells":{"code":{"kind":"string","value":"function testClearWithPrefixes() {\n\t\t$FileOne =& new FileEngine();\n\t\t$FileOne->init(array(\n\t\t\t'prefix' => 'prefix_one_',\n\t\t\t'duration' => DAY\n\t\t));\n\t\t$FileTwo =& new FileEngine();\n\t\t$FileTwo->init(array(\n\t\t\t'prefix' => 'prefix_two_',\n\t\t\t'duration' => DAY\n\t\t));\n\n\t\t$data1 = $data2 = $expected = 'content to cache';\n\t\t$FileOne->write('key_one', $data1, DAY);\n\t\t$FileTwo->write('key_two', $data2, DAY);\n\n\t\t$this->assertEqual($FileOne->read('key_one'), $expected);\n\t\t$this->assertEqual($FileTwo->read('key_two'), $expected);\n\n\t\t$FileOne->clear(false);\n\t\t$this->assertEqual($FileTwo->read('key_two'), $expected, 'secondary config was cleared by accident.');\n\t}"},"docstring":{"kind":"string","value":"test that clear() doesn't wipe files not in the current engine's prefix.\n\n@return void"},"func_name":{"kind":"string","value":"testClearWithPrefixes"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903459,"cells":{"code":{"kind":"string","value":"function testKeyPath() {\n\t\t$result = Cache::write('views.countries.something', 'here');\n\t\t$this->assertTrue($result);\n\t\t$this->assertTrue(file_exists(CACHE . 'cake_views_countries_something'));\n\n\t\t$result = Cache::read('views.countries.something');\n\t\t$this->assertEqual($result, 'here');\n\n\t\t$result = Cache::clear();\n\t\t$this->assertTrue($result);\n\t}"},"docstring":{"kind":"string","value":"testKeyPath method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testKeyPath"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903460,"cells":{"code":{"kind":"string","value":"function testRemoveWindowsSlashesFromCache() {\n\t\tCache::config('windows_test', array('engine' => 'File', 'isWindows' => true, 'prefix' => null, 'path' => TMP));\n\n\t\t$expected = array (\n\t\t\t'C:\\dev\\prj2\\sites\\cake\\libs' => array(\n\t\t\t\t0 => 'C:\\dev\\prj2\\sites\\cake\\libs', 1 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view',\n\t\t\t\t2 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\scaffolds', 3 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\pages',\n\t\t\t\t4 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\layouts', 5 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\layouts\\xml',\n\t\t\t\t6 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\layouts\\rss', 7 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\layouts\\js',\n\t\t\t\t8 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\layouts\\email', 9 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\layouts\\email\\text',\n\t\t\t\t10 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\layouts\\email\\html', 11 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\helpers',\n\t\t\t\t12 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\errors', 13 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\elements',\n\t\t\t\t14 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\elements\\email', 15 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\elements\\email\\text',\n\t\t\t\t16 => 'C:\\dev\\prj2\\sites\\cake\\libs\\view\\elements\\email\\html', 17 => 'C:\\dev\\prj2\\sites\\cake\\libs\\model',\n\t\t\t\t18 => 'C:\\dev\\prj2\\sites\\cake\\libs\\model\\datasources', 19 => 'C:\\dev\\prj2\\sites\\cake\\libs\\model\\datasources\\dbo',\n\t\t\t\t20 => 'C:\\dev\\prj2\\sites\\cake\\libs\\model\\behaviors', 21 => 'C:\\dev\\prj2\\sites\\cake\\libs\\controller',\n\t\t\t\t22 => 'C:\\dev\\prj2\\sites\\cake\\libs\\controller\\components', 23 => 'C:\\dev\\prj2\\sites\\cake\\libs\\cache'),\n\t\t\t'C:\\dev\\prj2\\sites\\main_site\\vendors' => array(\n\t\t\t\t0 => 'C:\\dev\\prj2\\sites\\main_site\\vendors', 1 => 'C:\\dev\\prj2\\sites\\main_site\\vendors\\shells',\n\t\t\t\t2 => 'C:\\dev\\prj2\\sites\\main_site\\vendors\\shells\\templates', 3 => 'C:\\dev\\prj2\\sites\\main_site\\vendors\\shells\\templates\\cdc_project',\n\t\t\t\t4 => 'C:\\dev\\prj2\\sites\\main_site\\vendors\\shells\\tasks', 5 => 'C:\\dev\\prj2\\sites\\main_site\\vendors\\js',\n\t\t\t\t6 => 'C:\\dev\\prj2\\sites\\main_site\\vendors\\css'),\n\t\t\t'C:\\dev\\prj2\\sites\\vendors' => array(\n\t\t\t\t0 => 'C:\\dev\\prj2\\sites\\vendors', 1 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest',\n\t\t\t\t2 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\test', 3 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\test\\support',\n\t\t\t\t4 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\test\\support\\collector', 5 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\extensions',\n\t\t\t\t6 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\extensions\\testdox', 7 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\docs',\n\t\t\t\t8 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\docs\\fr', 9 => 'C:\\dev\\prj2\\sites\\vendors\\simpletest\\docs\\en'),\n\t\t\t'C:\\dev\\prj2\\sites\\main_site\\views\\helpers' => array(\n\t\t\t\t0 => 'C:\\dev\\prj2\\sites\\main_site\\views\\helpers')\n\t\t);\n\n\t\tCache::write('test_dir_map', $expected, 'windows_test');\n\t\t$data = Cache::read('test_dir_map', 'windows_test');\n\t\tCache::delete('test_dir_map', 'windows_test');\n\t\t$this->assertEqual($expected, $data);\n\n\t\tCache::drop('windows_test');\n\t}"},"docstring":{"kind":"string","value":"testRemoveWindowsSlashesFromCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testRemoveWindowsSlashesFromCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903461,"cells":{"code":{"kind":"string","value":"function testWriteQuotedString() {\n\t\tCache::config('default', array('engine' => 'File', 'path' => TMP . 'tests'));\n\t\tCache::write('App.doubleQuoteTest', '\"this is a quoted string\"');\n\t\t$this->assertIdentical(Cache::read('App.doubleQuoteTest'), '\"this is a quoted string\"');\n\t\tCache::write('App.singleQuoteTest', \"'this is a quoted string'\");\n\t\t$this->assertIdentical(Cache::read('App.singleQuoteTest'), \"'this is a quoted string'\");\n\n\t\tCache::config('default', array('isWindows' => true, 'path' => TMP . 'tests'));\n\t\t$this->assertIdentical(Cache::read('App.doubleQuoteTest'), '\"this is a quoted string\"');\n\t\tCache::write('App.singleQuoteTest', \"'this is a quoted string'\");\n\t\t$this->assertIdentical(Cache::read('App.singleQuoteTest'), \"'this is a quoted string'\");\n\t}"},"docstring":{"kind":"string","value":"testWriteQuotedString method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testWriteQuotedString"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903462,"cells":{"code":{"kind":"string","value":"function testErrorWhenPathDoesNotExist() {\n\t\tif ($this->skipIf(is_dir(TMP . 'tests' . DS . 'file_failure'), 'Cannot run test directory exists. %s')) {\n\t\t\treturn;\n\t\t}\n\t\t$this->expectError();\n\t\tCache::config('failure', array(\n\t\t\t'engine' => 'File',\n\t\t\t'path' => TMP . 'tests' . DS . 'file_failure'\n\t\t));\n\n\t\tCache::drop('failure');\n\t}"},"docstring":{"kind":"string","value":"check that FileEngine generates an error when a configured Path does not exist.\n\n@return void"},"func_name":{"kind":"string","value":"testErrorWhenPathDoesNotExist"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/file.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903463,"cells":{"code":{"kind":"string","value":"function parseServerString($server) {\n\t\treturn $this->_parseServerString($server);\n\t}"},"docstring":{"kind":"string","value":"public accessor to _parseServerString\n\n@param string $server\n@return array"},"func_name":{"kind":"string","value":"parseServerString"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903464,"cells":{"code":{"kind":"string","value":"function skip() {\n\t\t$skip = true;\n\t\tif (class_exists('Memcache')) {\n\t\t\t$skip = false;\n\t\t}\n\t\t$this->skipIf($skip, '%s Memcache is not installed or configured properly.');\n\t}"},"docstring":{"kind":"string","value":"skip method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"skip"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903465,"cells":{"code":{"kind":"string","value":"function setUp() {\n\t\t$this->_cacheDisable = Configure::read('Cache.disable');\n\t\tConfigure::write('Cache.disable', false);\n\t\tCache::config('memcache', array(\n\t\t\t'engine' => 'Memcache',\n\t\t\t'prefix' => 'cake_',\n\t\t\t'duration' => 3600\n\t\t));\n\t}"},"docstring":{"kind":"string","value":"setUp method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"setUp"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903466,"cells":{"code":{"kind":"string","value":"function tearDown() {\n\t\tConfigure::write('Cache.disable', $this->_cacheDisable);\n\t\tCache::drop('memcache');\n\t\tCache::config('default');\n\t}"},"docstring":{"kind":"string","value":"tearDown method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"tearDown"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903467,"cells":{"code":{"kind":"string","value":"function testSettings() {\n\t\t$settings = Cache::settings();\n\t\tunset($settings['serialize'], $settings['path']);\n\t\t$expecting = array(\n\t\t\t'prefix' => 'cake_',\n\t\t\t'duration'=> 3600,\n\t\t\t'probability' => 100,\n\t\t\t'servers' => array('127.0.0.1'),\n\t\t\t'compress' => false,\n\t\t\t'engine' => 'Memcache',\n\t\t\t'persistent' => true,\n\t\t);\n\t\t$this->assertEqual($settings, $expecting);\n\t}"},"docstring":{"kind":"string","value":"testSettings method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testSettings"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903468,"cells":{"code":{"kind":"string","value":"function testMultipleServers() {\n\t\t$servers = array('127.0.0.1:11211', '127.0.0.1:11222');\n\t\t$available = true;\n\t\t$Memcache =& new Memcache();\n\n\t\tforeach($servers as $server) {\n\t\t\tlist($host, $port) = explode(':', $server);\n\t\t\tif (!@$Memcache->connect($host, $port)) {\n\t\t\t\t$available = false;\n\t\t\t}\n\t\t}\n\n\t\tif ($this->skipIf(!$available, '%s Need memcache servers at ' . implode(', ', $servers) . ' to run this test')) {\n\t\t\treturn;\n\t\t}\n\t\t$Memcache =& new MemcacheEngine();\n\t\t$Memcache->init(array('engine' => 'Memcache', 'servers' => $servers));\n\n\t\t$servers = array_keys($Memcache->__Memcache->getExtendedStats());\n\t\t$settings = $Memcache->settings();\n\t\t$this->assertEqual($servers, $settings['servers']);\n\t\tCache::drop('dual_server');\n\t}"},"docstring":{"kind":"string","value":"testSettings method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testMultipleServers"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903469,"cells":{"code":{"kind":"string","value":"function testConnect() {\n\t\t$Memcache =& new MemcacheEngine();\n\t\t$Memcache->init(Cache::settings('memcache'));\n\t\t$result = $Memcache->connect('127.0.0.1');\n\t\t$this->assertTrue($result);\n\t}"},"docstring":{"kind":"string","value":"testConnect method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testConnect"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903470,"cells":{"code":{"kind":"string","value":"function testConnectIpv6() {\n\t\t$Memcache =& new MemcacheEngine();\n\t\t$result = $Memcache->init(array(\n\t\t\t'prefix' => 'cake_',\n\t\t\t'duration' => 200,\n\t\t\t'engine' => 'Memcache',\n\t\t\t'servers' => array(\n\t\t\t\t'[::1]:11211'\n\t\t\t)\n\t\t));\n\t\t$this->assertTrue($result);\n\t}"},"docstring":{"kind":"string","value":"test connecting to an ipv6 server.\n\n@return void"},"func_name":{"kind":"string","value":"testConnectIpv6"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903471,"cells":{"code":{"kind":"string","value":"function testReadAndWriteCache() {\n\t\tCache::set(array('duration' => 1));\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = '';\n\t\t$this->assertEqual($result, $expecting);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('test', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = $data;\n\t\t$this->assertEqual($result, $expecting);\n\n\t\tCache::delete('test');\n\t}"},"docstring":{"kind":"string","value":"testReadAndWriteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testReadAndWriteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903472,"cells":{"code":{"kind":"string","value":"function testExpiry() {\n\t\tCache::set(array('duration' => 1));\n\n\t\t$result = Cache::read('test');\n\t\t$this->assertFalse($result);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\n\t\tCache::set(array('duration' => \"+1 second\"));\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\n\t\tCache::config('memcache', array('duration' => '+1 second'));\n\t\tsleep(2);\n\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\n\t\tCache::config('memcache', array('duration' => '+29 days'));\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('long_expiry_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('long_expiry_test');\n\t\t$expecting = $data;\n\t\t$this->assertEqual($result, $expecting);\n\n\t\tCache::config('memcache', array('duration' => 3600));\n\t}"},"docstring":{"kind":"string","value":"testExpiry method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testExpiry"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903473,"cells":{"code":{"kind":"string","value":"function testDeleteCache() {\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('delete_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::delete('delete_test');\n\t\t$this->assertTrue($result);\n\t}"},"docstring":{"kind":"string","value":"testDeleteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testDeleteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903474,"cells":{"code":{"kind":"string","value":"function testDecrement() {\n\t\t$result = Cache::write('test_decrement', 5);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::decrement('test_decrement');\n\t\t$this->assertEqual(4, $result);\n\n\t\t$result = Cache::read('test_decrement');\n\t\t$this->assertEqual(4, $result);\n\n\t\t$result = Cache::decrement('test_decrement', 2);\n\t\t$this->assertEqual(2, $result);\n\n\t\t$result = Cache::read('test_decrement');\n\t\t$this->assertEqual(2, $result);\n\t}"},"docstring":{"kind":"string","value":"testDecrement method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testDecrement"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903475,"cells":{"code":{"kind":"string","value":"function testIncrement() {\n\t\t$result = Cache::write('test_increment', 5);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::increment('test_increment');\n\t\t$this->assertEqual(6, $result);\n\n\t\t$result = Cache::read('test_increment');\n\t\t$this->assertEqual(6, $result);\n\n\t\t$result = Cache::increment('test_increment', 2);\n\t\t$this->assertEqual(8, $result);\n\n\t\t$result = Cache::read('test_increment');\n\t\t$this->assertEqual(8, $result);\n\t}"},"docstring":{"kind":"string","value":"testIncrement method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testIncrement"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903476,"cells":{"code":{"kind":"string","value":"function testConfigurationConflict() {\n\t\tCache::config('long_memcache', array(\n\t\t 'engine' => 'Memcache',\n\t\t 'duration'=> '+2 seconds',\n\t\t 'servers' => array('127.0.0.1:11211'),\n\t\t));\n\t\tCache::config('short_memcache', array(\n\t\t 'engine' => 'Memcache',\n\t\t 'duration'=> '+1 seconds',\n\t\t 'servers' => array('127.0.0.1:11211'),\n\t\t));\n\t\tCache::config('some_file', array('engine' => 'File'));\n\n\t\t$this->assertTrue(Cache::write('duration_test', 'yay', 'long_memcache'));\n\t\t$this->assertTrue(Cache::write('short_duration_test', 'boo', 'short_memcache'));\n\n\t\t$this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s');\n\t\t$this->assertEqual(Cache::read('short_duration_test', 'short_memcache'), 'boo', 'Value was not read %s');\n\n\t\tsleep(1);\n\t\t$this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s');\n\n\t\tsleep(2);\n\t\t$this->assertFalse(Cache::read('short_duration_test', 'short_memcache'), 'Cache was not invalidated %s');\n\t\t$this->assertFalse(Cache::read('duration_test', 'long_memcache'), 'Value did not expire %s');\n\n\t\tCache::delete('duration_test', 'long_memcache');\n\t\tCache::delete('short_duration_test', 'short_memcache');\n\t}"},"docstring":{"kind":"string","value":"test that configurations don't conflict, when a file engine is declared after a memcache one.\n\n@return void"},"func_name":{"kind":"string","value":"testConfigurationConflict"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903477,"cells":{"code":{"kind":"string","value":"function testZeroDuration() {\n\t\tCache::config('memcache', array('duration' => 0));\n\t\t$result = Cache::write('test_key', 'written!', 'memcache');\n\n\t\t$this->assertTrue($result, 'Could not write with duration 0');\n\t\t$result = Cache::read('test_key', 'memcache');\n\t\t$this->assertEqual($result, 'written!');\n\t}"},"docstring":{"kind":"string","value":"test that a 0 duration can succesfully write.\n\n@return void"},"func_name":{"kind":"string","value":"testZeroDuration"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903478,"cells":{"code":{"kind":"string","value":"function testLongDurationEqualToZero() {\n\t\t$memcache =& new TestMemcacheEngine();\n\t\t$memcache->settings['compress'] = false;\n\n\t\t$mock = new MemcacheMockMemcache();\n\t\t$memcache->setMemcache($mock);\n\t\t$mock->expectAt(0, 'set', array('key', 'value', false, 0));\n\n\t\t$value = 'value';\n\t\t$memcache->write('key', $value, 50 * DAY);\n\t}"},"docstring":{"kind":"string","value":"test that durations greater than 30 days never expire\n\n@return void"},"func_name":{"kind":"string","value":"testLongDurationEqualToZero"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/memcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903479,"cells":{"code":{"kind":"string","value":"function skip() {\n\t\t$skip = true;\n\t\tif (function_exists('xcache_set')) {\n\t\t\t$skip = false;\n\t\t}\n\t\t$this->skipIf($skip, '%s Xcache is not installed or configured properly');\n\t}"},"docstring":{"kind":"string","value":"skip method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"skip"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903480,"cells":{"code":{"kind":"string","value":"function setUp() {\n\t\t$this->_cacheDisable = Configure::read('Cache.disable');\n\t\tConfigure::write('Cache.disable', false);\n\t\tCache::config('xcache', array('engine' => 'Xcache', 'prefix' => 'cake_'));\n\t}"},"docstring":{"kind":"string","value":"setUp method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"setUp"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903481,"cells":{"code":{"kind":"string","value":"function tearDown() {\n\t\tConfigure::write('Cache.disable', $this->_cacheDisable);\n\t\tCache::config('default');\n\t}"},"docstring":{"kind":"string","value":"tearDown method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"tearDown"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903482,"cells":{"code":{"kind":"string","value":"function testSettings() {\n\t\t$settings = Cache::settings();\n\t\t$expecting = array(\n\t\t\t'prefix' => 'cake_',\n\t\t\t'duration'=> 3600,\n\t\t\t'probability' => 100,\n\t\t\t'engine' => 'Xcache',\n\t\t);\n\t\t$this->assertTrue(isset($settings['PHP_AUTH_USER']));\n\t\t$this->assertTrue(isset($settings['PHP_AUTH_PW']));\n\n\t\tunset($settings['PHP_AUTH_USER'], $settings['PHP_AUTH_PW']);\n\t\t$this->assertEqual($settings, $expecting);\n\t}"},"docstring":{"kind":"string","value":"testSettings method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testSettings"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903483,"cells":{"code":{"kind":"string","value":"function testReadAndWriteCache() {\n\t\tCache::set(array('duration' => 1));\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = '';\n\t\t$this->assertEqual($result, $expecting);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('test', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::read('test');\n\t\t$expecting = $data;\n\t\t$this->assertEqual($result, $expecting);\n\n\t\tCache::delete('test');\n\t}"},"docstring":{"kind":"string","value":"testReadAndWriteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testReadAndWriteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903484,"cells":{"code":{"kind":"string","value":"function testExpiry() {\n\t\tCache::set(array('duration' => 1));\n\t\t$result = Cache::read('test');\n\t\t$this->assertFalse($result);\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\n\t\tCache::set(array('duration' => \"+1 second\"));\n\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('other_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\tsleep(2);\n\t\t$result = Cache::read('other_test');\n\t\t$this->assertFalse($result);\n\t}"},"docstring":{"kind":"string","value":"testExpiry method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testExpiry"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903485,"cells":{"code":{"kind":"string","value":"function testDeleteCache() {\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('delete_test', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::delete('delete_test');\n\t\t$this->assertTrue($result);\n\t}"},"docstring":{"kind":"string","value":"testDeleteCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testDeleteCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903486,"cells":{"code":{"kind":"string","value":"function testClearCache() {\n\t\t$data = 'this is a test of the emergency broadcasting system';\n\t\t$result = Cache::write('clear_test_1', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::write('clear_test_2', $data);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::clear();\n\t\t$this->assertTrue($result);\n\t}"},"docstring":{"kind":"string","value":"testClearCache method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testClearCache"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903487,"cells":{"code":{"kind":"string","value":"function testDecrement() {\n\t\t$result = Cache::write('test_decrement', 5);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::decrement('test_decrement');\n\t\t$this->assertEqual(4, $result);\n\n\t\t$result = Cache::read('test_decrement');\n\t\t$this->assertEqual(4, $result);\n\n\t\t$result = Cache::decrement('test_decrement', 2);\n\t\t$this->assertEqual(2, $result);\n\n\t\t$result = Cache::read('test_decrement');\n\t\t$this->assertEqual(2, $result);\n\t}"},"docstring":{"kind":"string","value":"testDecrement method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testDecrement"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903488,"cells":{"code":{"kind":"string","value":"function testIncrement() {\n\t\t$result = Cache::write('test_increment', 5);\n\t\t$this->assertTrue($result);\n\n\t\t$result = Cache::increment('test_increment');\n\t\t$this->assertEqual(6, $result);\n\n\t\t$result = Cache::read('test_increment');\n\t\t$this->assertEqual(6, $result);\n\n\t\t$result = Cache::increment('test_increment', 2);\n\t\t$this->assertEqual(8, $result);\n\n\t\t$result = Cache::read('test_increment');\n\t\t$this->assertEqual(8, $result);\n\t}"},"docstring":{"kind":"string","value":"testIncrement method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testIncrement"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/cache/xcache.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903489,"cells":{"code":{"kind":"string","value":"function initialize(&$controller, $settings) {\n\t\tforeach ($settings as $key => $value) {\n\t\t\tif (is_numeric($key)) {\n\t\t\t\t$this->{$value} = true;\n\t\t\t} else {\n\t\t\t\t$this->{$key} = $value;\n\t\t\t}\n\t\t}\n\t}"},"docstring":{"kind":"string","value":"initialize method\n\n@param mixed $controller\n@param mixed $settings\n@access public\n@return void"},"func_name":{"kind":"string","value":"initialize"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903490,"cells":{"code":{"kind":"string","value":"function startup(&$controller) {\n\t\t$this->testName = $controller->name;\n\t}"},"docstring":{"kind":"string","value":"startup method\n\n@param mixed $controller\n@access public\n@return void"},"func_name":{"kind":"string","value":"startup"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903491,"cells":{"code":{"kind":"string","value":"function initialize(&$controller, $settings) {\n\t\t$this->Controller = $controller;\n\t\t$this->Banana->testField = 'OrangeField';\n\t\t$this->settings = $settings;\n\t}"},"docstring":{"kind":"string","value":"initialize method\n\n@param mixed $controller\n@access public\n@return void"},"func_name":{"kind":"string","value":"initialize"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903492,"cells":{"code":{"kind":"string","value":"function startup(&$controller) {\n\t\t$controller->foo = 'pass';\n\t}"},"docstring":{"kind":"string","value":"startup method\n\n@param Controller $controller\n@return string\n@access public"},"func_name":{"kind":"string","value":"startup"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903493,"cells":{"code":{"kind":"string","value":"function startup(&$controller) {\n\t\t$controller->bar = 'fail';\n\t}"},"docstring":{"kind":"string","value":"startup method\n\n@param Controller $controller\n@return string\n@access public"},"func_name":{"kind":"string","value":"startup"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903494,"cells":{"code":{"kind":"string","value":"function setUp() {\n\t\t$this->_pluginPaths = App::path('plugins');\n\t\tApp::build(array(\n\t\t\t'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)\n\t\t));\n\t}"},"docstring":{"kind":"string","value":"setUp method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"setUp"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903495,"cells":{"code":{"kind":"string","value":"function tearDown() {\n\t\tApp::build();\n\t\tClassRegistry::flush();\n\t}"},"docstring":{"kind":"string","value":"tearDown method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"tearDown"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903496,"cells":{"code":{"kind":"string","value":"function testLoadComponents() {\n\t\t$Controller =& new ComponentTestController();\n\t\t$Controller->components = array('RequestHandler');\n\n\t\t$Component =& new Component();\n\t\t$Component->init($Controller);\n\n\t\t$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));\n\n\t\t$Controller =& new ComponentTestController();\n\t\t$Controller->plugin = 'test_plugin';\n\t\t$Controller->components = array('RequestHandler', 'TestPluginComponent');\n\n\t\t$Component =& new Component();\n\t\t$Component->init($Controller);\n\n\t\t$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));\n\t\t$this->assertTrue(is_a($Controller->TestPluginComponent, 'TestPluginComponentComponent'));\n\t\t$this->assertTrue(is_a(\n\t\t\t$Controller->TestPluginComponent->TestPluginOtherComponent,\n\t\t\t'TestPluginOtherComponentComponent'\n\t\t));\n\t\t$this->assertFalse(isset($Controller->TestPluginOtherComponent));\n\n\t\t$Controller =& new ComponentTestController();\n\t\t$Controller->components = array('Security');\n\n\t\t$Component =& new Component();\n\t\t$Component->init($Controller);\n\n\t\t$this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));\n\t\t$this->assertTrue(is_a($Controller->Security->Session, 'SessionComponent'));\n\n\t\t$Controller =& new ComponentTestController();\n\t\t$Controller->components = array('Security', 'Cookie', 'RequestHandler');\n\n\t\t$Component =& new Component();\n\t\t$Component->init($Controller);\n\n\t\t$this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));\n\t\t$this->assertTrue(is_a($Controller->Security->RequestHandler, 'RequestHandlerComponent'));\n\t\t$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));\n\t\t$this->assertTrue(is_a($Controller->Cookie, 'CookieComponent'));\n\t}"},"docstring":{"kind":"string","value":"testLoadComponents method\n\n@access public\n@return void"},"func_name":{"kind":"string","value":"testLoadComponents"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903497,"cells":{"code":{"kind":"string","value":"function testComponentStartup() {\n\t\t$Controller =& new ComponentTestController();\n\t\t$Controller->components = array('Apple');\n\t\t$Controller->uses = false;\n\t\t$Controller->constructClasses();\n\t\t$Controller->Component->initialize($Controller);\n\t\t$Controller->beforeFilter();\n\t\t$Controller->Component->startup($Controller);\n\n\t\t$this->assertTrue(is_a($Controller->Apple, 'AppleComponent'));\n\t\t$this->assertEqual($Controller->Apple->testName, 'ComponentTest');\n\n\t\t$expected = !(defined('APP_CONTROLLER_EXISTS') && APP_CONTROLLER_EXISTS);\n\t\t$this->assertEqual(isset($Controller->foo), $expected);\n\t\t$this->assertFalse(isset($Controller->bar));\n\t}"},"docstring":{"kind":"string","value":"Tests Component::startup() and only running callbacks for components directly attached to\nthe controller.\n\n@return void"},"func_name":{"kind":"string","value":"testComponentStartup"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903498,"cells":{"code":{"kind":"string","value":"function testTriggerCallback() {\n\t\t$Controller =& new ComponentTestController();\n\t\t$Controller->components = array('ComponentMock');\n\t\t$Controller->uses = null;\n\t\t$Controller->constructClasses();\n\n\t\t$Controller->ComponentMock->expectOnce('beforeRender');\n\t\t$Controller->Component->triggerCallback('beforeRender', $Controller);\n\n\t\t$Controller->ComponentMock->expectNever('beforeFilter');\n\t\t$Controller->ComponentMock->enabled = false;\n\t\t$Controller->Component->triggerCallback('beforeFilter', $Controller);\n\t}"},"docstring":{"kind":"string","value":"test that triggerCallbacks fires methods on all the components, and can trigger any method.\n\n@return void"},"func_name":{"kind":"string","value":"testTriggerCallback"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}},{"rowIdx":903499,"cells":{"code":{"kind":"string","value":"function testMultipleComponentInitialize() {\n\t\t$Controller =& new ComponentTestController();\n\t\t$Controller->uses = false;\n\t\t$Controller->components = array('Orange', 'Banana');\n\t\t$Controller->constructClasses();\n\t\t$Controller->Component->initialize($Controller);\n\n\t\t$this->assertEqual($Controller->Banana->testField, 'OrangeField');\n\t\t$this->assertEqual($Controller->Orange->Banana->testField, 'OrangeField');\n\t}"},"docstring":{"kind":"string","value":"test a component being used more than once.\n\n@return void"},"func_name":{"kind":"string","value":"testMultipleComponentInitialize"},"language":{"kind":"string","value":"php"},"repo":{"kind":"string","value":"Datawalke/Coordino"},"path":{"kind":"string","value":"cake/tests/cases/libs/controller/component.test.php"},"url":{"kind":"string","value":"https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php"},"license":{"kind":"string","value":"MIT"}}}],"truncated":false,"partial":false},"paginationData":{"pageIndex":9034,"numItemsPerPage":100,"numTotalItems":905197,"offset":903400,"length":100}},"jwt":"eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc1NjMzMDc1OSwic3ViIjoiL2RhdGFzZXRzL1NodXUxMjEyMS9waHAtdHJlZXNpdHRlci1maWx0ZXJlZC1kYXRhc2V0c1YyIiwiZXhwIjoxNzU2MzM0MzU5LCJpc3MiOiJodHRwczovL2h1Z2dpbmdmYWNlLmNvIn0.Di9O5yQPu82UPYPCvk1NrC7o-M_zj8O_AvOcLmVJHh0peaE59NnXSWTqqbCnGFD5dYJdHTVka0JHlMqxdgnzAg","displayUrls":true},"discussionsStats":{"closed":0,"open":0,"total":0},"fullWidth":true,"hasGatedAccess":true,"hasFullAccess":true,"isEmbedded":false,"savedQueries":{"community":[],"user":[]}}">
code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
function testPostal() { $this->assertFalse(Validation::postal('111', null, 'de')); $this->assertFalse(Validation::postal('1111', null, 'de')); $this->assertTrue(Validation::postal('13089', null, 'de')); $this->assertFalse(Validation::postal('111', null, 'be')); $this->assertFalse(Validation::postal('0123', null, 'be')); $this->assertTrue(Validation::postal('1204', null, 'be')); $this->assertFalse(Validation::postal('111', null, 'it')); $this->assertFalse(Validation::postal('1111', null, 'it')); $this->assertTrue(Validation::postal('13089', null, 'it')); $this->assertFalse(Validation::postal('111', null, 'uk')); $this->assertFalse(Validation::postal('1111', null, 'uk')); $this->assertFalse(Validation::postal('AZA 0AB', null, 'uk')); $this->assertFalse(Validation::postal('X0A 0ABC', null, 'uk')); $this->assertTrue(Validation::postal('X0A 0AB', null, 'uk')); $this->assertTrue(Validation::postal('AZ0A 0AA', null, 'uk')); $this->assertTrue(Validation::postal('A89 2DD', null, 'uk')); $this->assertFalse(Validation::postal('111', null, 'ca')); $this->assertFalse(Validation::postal('1111', null, 'ca')); $this->assertFalse(Validation::postal('D2A 0A0', null, 'ca')); $this->assertFalse(Validation::postal('BAA 0ABC', null, 'ca')); $this->assertFalse(Validation::postal('B2A AABC', null, 'ca')); $this->assertFalse(Validation::postal('B2A 2AB', null, 'ca')); $this->assertTrue(Validation::postal('X0A 0A2', null, 'ca')); $this->assertTrue(Validation::postal('G4V 4C3', null, 'ca')); $this->assertTrue(Validation::postal('L4J8D6', null, 'ca')); $this->assertFalse(Validation::postal('111', null, 'us')); $this->assertFalse(Validation::postal('1111', null, 'us')); $this->assertFalse(Validation::postal('130896', null, 'us')); $this->assertFalse(Validation::postal('13089-33333', null, 'us')); $this->assertFalse(Validation::postal('13089-333', null, 'us')); $this->assertFalse(Validation::postal('13A89-4333', null, 'us')); $this->assertTrue(Validation::postal('13089-3333', null, 'us')); $this->assertFalse(Validation::postal('111')); $this->assertFalse(Validation::postal('1111')); $this->assertFalse(Validation::postal('130896')); $this->assertFalse(Validation::postal('13089-33333')); $this->assertFalse(Validation::postal('13089-333')); $this->assertFalse(Validation::postal('13A89-4333')); $this->assertTrue(Validation::postal('13089-3333')); }
testPostal method @access public @return void
testPostal
php
Datawalke/Coordino
cake/tests/cases/libs/validation.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/validation.test.php
MIT
function testPhonePostalSsnPass() { $this->assertTrue(Validation::postal('text', null, 'testNl')); $this->assertTrue(Validation::phone('text', null, 'testDe')); $this->assertTrue(Validation::ssn('text', null, 'testNl')); }
test that phone and postal pass to other classes. @return void
testPhonePostalSsnPass
php
Datawalke/Coordino
cake/tests/cases/libs/validation.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/validation.test.php
MIT
function testPassThroughMethod() { $this->assertTrue(Validation::postal('text', null, 'testNl')); $this->expectError('Could not find AUTOFAILValidation class, unable to complete validation.'); Validation::postal('text', null, 'AUTOFAIL'); $this->expectError('Method phone does not exist on TestNlValidation unable to complete validation.'); Validation::phone('text', null, 'testNl'); }
test the pass through calling of an alternate locale with postal() @return void
testPassThroughMethod
php
Datawalke/Coordino
cake/tests/cases/libs/validation.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/validation.test.php
MIT
function testSsn() { $this->assertFalse(Validation::ssn('111-333', null, 'dk')); $this->assertFalse(Validation::ssn('111111-333', null, 'dk')); $this->assertTrue(Validation::ssn('111111-3334', null, 'dk')); $this->assertFalse(Validation::ssn('1118333', null, 'nl')); $this->assertFalse(Validation::ssn('1234567890', null, 'nl')); $this->assertFalse(Validation::ssn('12345A789', null, 'nl')); $this->assertTrue(Validation::ssn('123456789', null, 'nl')); $this->assertFalse(Validation::ssn('11-33-4333', null, 'us')); $this->assertFalse(Validation::ssn('113-3-4333', null, 'us')); $this->assertFalse(Validation::ssn('111-33-333', null, 'us')); $this->assertTrue(Validation::ssn('111-33-4333', null, 'us')); }
testSsn method @access public @return void
testSsn
php
Datawalke/Coordino
cake/tests/cases/libs/validation.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/validation.test.php
MIT
function testUserDefined() { $validator = new CustomValidator; $this->assertFalse(Validation::userDefined('33', $validator, 'customValidate')); $this->assertFalse(Validation::userDefined('3333', $validator, 'customValidate')); $this->assertTrue(Validation::userDefined('333', $validator, 'customValidate')); }
testUserDefined method @access public @return void
testUserDefined
php
Datawalke/Coordino
cake/tests/cases/libs/validation.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/validation.test.php
MIT
function setUp() { $manager =& new XmlManager(); $manager->namespaces = array(); }
setUp method @access public @return void
setUp
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testRootTagParsing() { $input = '<' . '?xml version="1.0" encoding="UTF-8" ?' . '>' . "\n" . '<plugin id="1" version_id="1" name="my_plugin" title="My Plugin" author="Me" author_email="[email protected]" description="My awesome package" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13">' .'<current id="1" plugin_id="1" name="1.0" file="" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13" />' .'<version id="1" plugin_id="1" name="1.0" file="" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13" />' .'</plugin>'; $xml = new Xml($input); $this->assertEqual($xml->children[0]->name, 'plugin'); $this->assertEqual($xml->children[0]->children[0]->name, 'current'); $this->assertEqual($xml->toString(true), $input); }
testRootTagParsing method @access public @return void
testRootTagParsing
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSerialization() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial') ), array( 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education') ) ); $xml = new Xml($input); $result = preg_replace("/\n/",'', $xml->toString(false)); $expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name="" /><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project><project id="2" title="" client_id="2" show="1" is_spotlight="" style_id="0" job_type_id="2" industry_id="2" modified="2007-11-26 14:48:36" created=""><style id="" name="" /><job_type id="2" name="Awareness Campaign" /><industry id="2" name="Education" /></project>'; $this->assertEqual($result, $expected); $input = array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial') ); $expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name="" /><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project>'; $xml = new Xml($input); $result = preg_replace("/\n/",'', $xml->toString(false)); $this->assertEqual($result, $expected); }
testSerialization method @access public @return void
testSerialization
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSerializeOnMultiDimensionalArray() { $data = array( 'Statuses' => array( array('Status' => array('id' => 1)), array('Status' => array('id' => 2)) ) ); $result =& new Xml($data, array('format' => 'tags')); $expected = '<statuses><status><id>1</id></status><status><id>2</id></status></statuses>'; $this->assertIdentical($result->toString(), $expected); }
testSerializeOnMultiDimensionalArray method @access public @return void
testSerializeOnMultiDimensionalArray
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSerializeCapsWithoutSlug() { $data = array( 'USERS' => array( array('USER' => array('ID' => 1)), array('USER' => array('ID' => 2)) ) ); $result =& new Xml($data, array('format' => 'tags', 'slug' => false)); $expected = '<USERS><USER><ID>1</ID></USER><USER><ID>2</ID></USER></USERS>'; $this->assertIdentical($result->toString(), $expected); }
testSerializeCapsWithoutSlug method @access public @return void
testSerializeCapsWithoutSlug
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSerializationOfBooleanAndBooleanishValues() { $xml =& new Xml(array('data' => array('example' => false))); $result = $xml->toString(false); $expected = '<data example="0" />'; $this->assertEqual($result, $expected, 'Boolean values incorrectly handled. %s'); $xml =& new Xml(array('data' => array('example' => true))); $result = $xml->toString(false); $expected = '<data example="1" />'; $this->assertEqual($result, $expected, 'Boolean values incorrectly handled. %s'); $xml =& new Xml(array('data' => array('example' => null))); $result = $xml->toString(false); $expected = '<data example="" />'; $this->assertEqual($result, $expected, 'Boolean values incorrectly handled. %s'); $xml =& new Xml(array('data' => array('example' => 0))); $result = $xml->toString(false); $expected = '<data example="0" />'; $this->assertEqual($result, $expected, 'Boolean-ish values incorrectly handled. %s'); $xml =& new Xml(array('data' => array('example' => 1))); $result = $xml->toString(false); $expected = '<data example="1" />'; $this->assertEqual($result, $expected, 'Boolean-ish values incorrectly handled. %s'); }
test serialization of boolean and null values. false = 0, true = 1, null = '' @return void
testSerializationOfBooleanAndBooleanishValues
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSimpleArray() { $xml = new Xml(array('hello' => 'world'), array('format' => 'tags')); $result = $xml->toString(false); $expected = '<hello><![CDATA[world]]></hello>'; $this->assertEqual($expected, $result); }
testSimpleArray method @access public @return void
testSimpleArray
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSimpleObject() { $input = new StdClass(); $input->hello = 'world'; $xml = new Xml($input, array('format' => 'tags')); $result = $xml->toString(false); $expected = '<hello><![CDATA[world]]></hello>'; $this->assertEqual($expected, $result); }
testSimpleObject method @access public @return void
testSimpleObject
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSimpleArrayWithZeroValues() { $xml = new Xml(array('zero_string' => '0', 'zero_integer' => 0), array('format' => 'tags')); $result = $xml->toString(false); $expected = '<zero_string>0</zero_string><zero_integer>0</zero_integer>'; $this->assertEqual($expected, $result); $data = array( 'Client' => array( 'id' => 3, 'object_id' => 9, 'key' => 'alt', 'name' => 'Client Two', 'created_by' => 4, 'status' => '0', 'num_projects' => 0 ) ); $xml = new Xml($data, array('format' => 'tags')); $result = $xml->toString(array('format' => 'tags', 'header' => false)); $this->assertPattern('/<status>0<\/status>/', $result); $this->assertPattern('/<num_projects>0<\/num_projects>/', $result); }
testSimpleArrayWithZeroValues method @access public @return void
testSimpleArrayWithZeroValues
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testHeader() { $input = new stdClass(); $input->hello = 'world'; $xml = new Xml($input, array('format' => 'tags')); $result = $xml->toString(array('header' => true)); $expected = '<'.'?xml version="1.0" encoding="UTF-8" ?'.'>'."\n".'<hello><![CDATA[world]]></hello>'; $this->assertEqual($expected, $result); }
testHeader method @access public @return void
testHeader
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testOwnerAssignment() { $xml = new Xml(); $node =& $xml->createElement('hello', 'world'); $owner =& $node->document(); $this->assertTrue($xml === $owner); $children =& $node->children; $childOwner =& $children[0]->document(); $this->assertTrue($xml === $childOwner); }
testOwnerAssignment method @access public @return void
testOwnerAssignment
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testArraySingleSerialization() { $input = array( 'Post' => array( 'id' => '1', 'author_id' => '1', 'title' => 'First Post', 'body' => 'First Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31' ), 'Author' => array( 'id' => '1', 'user' => 'mariano', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31', 'test' => 'working' ) ); $expected = '<post><id>1</id><author_id>1</author_id><title><![CDATA[First Post]]>'; $expected .= '</title><body><![CDATA[First Post Body]]></body><published><![CDATA[Y]]>'; $expected .= '</published><created><![CDATA[2007-03-18 10:39:23]]></created><updated>'; $expected .= '<![CDATA[2007-03-18 10:41:31]]></updated><author><id>1</id><user>'; $expected .= '<![CDATA[mariano]]></user><password><![CDATA[5f4dcc3b5aa765d61d8327deb882'; $expected .= 'cf99]]></password><created><![CDATA[2007-03-17 01:16:23]]></created>'; $expected .= '<updated><![CDATA[2007-03-17 01:18:31]]></updated><test><![CDATA[working]]>'; $expected .= '</test></author></post>'; $xml = new Xml($input, array('format' => 'tags')); $result = $xml->toString(false); $this->assertEqual($expected, $result); }
testArraySingleSerialization method @access public @return void
testArraySingleSerialization
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSerializationArray() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial') ), array( 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education'), ) ); $expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry></project>'; $xml = new Xml($input, array('format' => 'tags')); $result = $xml->toString(array('header' => false, 'cdata' => false)); $this->assertEqual($expected, $result); }
testArraySerialization method @access public @return void
testSerializationArray
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSerializationNestedArray() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial'), 'BusinessSolution' => array(array('id' => 6, 'name' => 'Convert Sales')), 'MediaType' => array( array('id' => 15, 'name' => 'Print'), array('id' => 7, 'name' => 'Web Demo'), array('id' => 6, 'name' => 'CD-ROM') ) ), array( 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education'), 'BusinessSolution' => array( array('id' => 4, 'name' => 'Build Relationship'), array('id' => 6, 'name' => 'Convert Sales') ), 'MediaType' => array( array('id' => 17, 'name' => 'Web'), array('id' => 6, 'name' => 'CD-ROM') ) ) ); $expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>15</id><name>Print</name></media_type><media_type><id>7</id><name>Web Demo</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry><business_solution><id>4</id><name>Build Relationship</name></business_solution><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>17</id><name>Web</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></project>'; $xml = new Xml($input, array('format' => 'tags')); $result = $xml->toString(array('header' => false, 'cdata' => false)); $this->assertEqual($expected, $result); }
testNestedArraySerialization method @access public @return void
testSerializationNestedArray
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testArraySerializationWithRoot() { $input = array( array('Shirt' => array('id' => 1, 'color' => 'green')), array('Shirt' => array('id' => 2, 'color' => 'blue')), ); $expected = '<collection><shirt id="1" color="green" />'; $expected .= '<shirt id="2" color="blue" /></collection>'; $Xml = new Xml($input, array('root' => 'collection')); $result = $Xml->toString(array('header' => false)); $this->assertEqual($expected, $result); }
Prove that serialization with a given root node works as expected. @access public @return void @link https://trac.cakephp.org/ticket/6294
testArraySerializationWithRoot
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testParsingWithNonStandardWhitespace() { $raw = '<?xml version="1.0" encoding="ISO-8859-1" ?><prices><price>1.0</price></prices>'; $array = array('Prices' => array('price' => 1.0)); $xml = new Xml($raw); $this->assertEqual($xml->toArray(), $array); $this->assertEqual($xml->__header, 'xml version="1.0" encoding="ISO-8859-1"'); $xml = new Xml(' ' . $raw); $this->assertEqual($xml->toArray(), $array); $this->assertEqual($xml->__header, 'xml version="1.0" encoding="ISO-8859-1"'); $xml = new Xml("\n" . $raw); $this->assertEqual($xml->toArray(), $array); $this->assertEqual($xml->__header, 'xml version="1.0" encoding="ISO-8859-1"'); }
Tests that XML documents with non-standard spacing (i.e. leading whitespace, whole document on one line) still parse properly. @return void
testParsingWithNonStandardWhitespace
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testAllCData() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => '1', 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => '1.89', 'industry_id' => '1.56', 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial') ), array( 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => '1', 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => '2.2', 'industry_id' => 2.2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education'), ) ); $expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1.89</job_type_id><industry_id>1.56</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name><![CDATA[Touch Screen Kiosk]]></name></job_type><industry><id>1</id><name><![CDATA[Financial]]></name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2.2</job_type_id><industry_id>2.2</industry_id><modified><![CDATA[2007-11-26 14:48:36]]></modified><created /><style><id /><name /></style><job_type><id>2</id><name><![CDATA[Awareness Campaign]]></name></job_type><industry><id>2</id><name><![CDATA[Education]]></name></industry></project>'; $xml = new Xml($input, array('format' => 'tags')); $result = $xml->toString(array('header' => false, 'cdata' => true)); $this->assertEqual($expected, $result); }
testAllCData method @access public @return void
testAllCData
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testWhitespace() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial') ), array( 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education'), ) ); $expected = "\n\t<project>\n\t\t<id>\n\t\t\t1\n\t\t</id>\n\t\t<title />\n\t\t<client_id>\n\t\t\t1\n\t\t</client_id>\n\t\t<show>\n\t\t\t1\n\t\t</show>\n\t\t<is_spotlight />\n\t\t<style_id>\n\t\t\t0\n\t\t</style_id>\n\t\t<job_type_id>\n\t\t\t1\n\t\t</job_type_id>\n\t\t<industry_id>\n\t\t\t1\n\t\t</industry_id>\n\t\t<modified />\n\t\t<created />\n\t\t<style>\n\t\t\t<id />\n\t\t\t<name />\n\t\t</style>\n\t\t<job_type>\n\t\t\t<id>\n\t\t\t\t1\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tTouch Screen Kiosk\n\t\t\t</name>\n\t\t</job_type>\n\t\t<industry>\n\t\t\t<id>\n\t\t\t\t1\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tFinancial\n\t\t\t</name>\n\t\t</industry>\n\t</project>\n\t<project>\n\t\t<id>\n\t\t\t2\n\t\t</id>\n\t\t<title />\n\t\t<client_id>\n\t\t\t2\n\t\t</client_id>\n\t\t<show>\n\t\t\t1\n\t\t</show>\n\t\t<is_spotlight />\n\t\t<style_id>\n\t\t\t0\n\t\t</style_id>\n\t\t<job_type_id>\n\t\t\t2\n\t\t</job_type_id>\n\t\t<industry_id>\n\t\t\t2\n\t\t</industry_id>\n\t\t<modified>\n\t\t\t2007-11-26 14:48:36\n\t\t</modified>\n\t\t<created />\n\t\t<style>\n\t\t\t<id />\n\t\t\t<name />\n\t\t</style>\n\t\t<job_type>\n\t\t\t<id>\n\t\t\t\t2\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tAwareness Campaign\n\t\t\t</name>\n\t\t</job_type>\n\t\t<industry>\n\t\t\t<id>\n\t\t\t\t2\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tEducation\n\t\t\t</name>\n\t\t</industry>\n\t</project>\n"; $xml = new Xml($input, array('format' => 'tags')); $result = $xml->toString(array('header' => false, 'cdata' => false, 'whitespace' => true)); $this->assertEqual($expected, $result); }
testWhitespace method @access public @return void
testWhitespace
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSetSerialization() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial') ), array( 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education'), ) ); $expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry></project>'; $xml = new Xml(Set::map($input), array('format' => 'tags')); $result = $xml->toString(array('header' => false, 'cdata' => false)); $this->assertEqual($expected, $result); }
testSetSerialization method @access public @return void
testSetSerialization
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testNormalizeNotAdding_name_Element() { $input = array( 'output' => array( 'Vouchers' => array( array('Voucher' => array('id' => 1)), array('Voucher' => array('id' => 2)), ), ) ); $xml = new Xml($input, array('attributes' => false, 'format' => 'tags')); $this->assertFalse(isset($xml->children[0]->children[0]->children[1]), 'Too many children %s'); $this->assertEqual($xml->children[0]->children[0]->children[0]->name, 'voucher'); }
ensure that normalize does not add _name_ elements that come from Set::map sometimes. @return void
testNormalizeNotAdding_name_Element
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testSimpleParsing() { $source = '<response><hello><![CDATA[happy world]]></hello><goodbye><![CDATA[cruel world]]></goodbye></response>'; $xml = new Xml($source); $result = $xml->toString(); $this->assertEqual($source, $result); }
testSimpleParsing method @access public @return void
testSimpleParsing
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testElementCollapsing() { $xmlDataThatFails = '<resultpackage> <result qid="46b1c46ed6208"><![CDATA[46b1c46ed3af9]]></result> <result qid="46b1c46ed332a"><![CDATA[]]></result> <result qid="46b1c46ed90e6"><![CDATA[46b1c46ed69d8]]></result> <result qid="46b1c46ed71a7"><![CDATA[46b1c46ed5a38]]></result> <result qid="46b1c46ed8146"><![CDATA[46b1c46ed98b6]]></result> <result qid="46b1c46ed7978"><![CDATA[]]></result> <result qid="46b1c46ed4a98"><![CDATA[]]></result> <result qid="46b1c46ed42c8"><![CDATA[]]></result> <result qid="46b1c46ed5268"><![CDATA[46b1c46ed8917]]></result> </resultpackage>'; $Xml = new Xml(); $Xml->load('<?xml version="1.0" encoding="UTF-8" ?>' . $xmlDataThatFails); $result = $Xml->toArray(false); $this->assertTrue(is_array($result)); $expected = array( 'resultpackage' => array( 'result' => array( 0 => array( 'value' => '46b1c46ed3af9', 'qid' => '46b1c46ed6208'), 1 => array( 'qid' => '46b1c46ed332a'), 2 => array( 'value' => '46b1c46ed69d8', 'qid' => '46b1c46ed90e6'), 3 => array( 'value' => '46b1c46ed5a38', 'qid' => '46b1c46ed71a7'), 4 => array( 'value' => '46b1c46ed98b6', 'qid' => '46b1c46ed8146'), 5 => array( 'qid' => '46b1c46ed7978'), 6 => array( 'qid' => '46b1c46ed4a98'), 7 => array( 'qid' => '46b1c46ed42c8'), 8 => array( 'value' => '46b1c46ed8917', 'qid' => '46b1c46ed5268'), ) )); $this->assertEqual( count($result['resultpackage']['result']), count($expected['resultpackage']['result']), 'Incorrect array length %s'); $this->assertFalse( isset($result['resultpackage']['result'][0][0]['qid']), 'Nested array exists, data is corrupt. %s'); $this->assertEqual($result, $expected); }
test that elements with empty tag values do not collapse and corrupt data structures @access public @return void
testElementCollapsing
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testCaseFoldingWithEmptyValues() { $filledValue = '<method name="set_user_settings"> <title>update user information</title> <user>1</user> <User> <id>1</id> <name>varchar(45)</name> </User> </method>'; $xml =& new XML($filledValue); $expected = array( 'Method' => array( 'name' => 'set_user_settings', 'title' => 'update user information', 'user' => '1', 'User' => array( 'id' => 1, 'name' => 'varchar(45)', ), ) ); $result = $xml->toArray(); $this->assertEqual($result, $expected); $emptyValue ='<method name="set_user_settings"> <title>update user information</title> <user></user> <User> <id>1</id> <name>varchar(45)</name> </User> </method>'; $xml =& new XML($emptyValue); $expected = array( 'Method' => array( 'name' => 'set_user_settings', 'title' => 'update user information', 'user' => array(), 'User' => array( 'id' => 1, 'name' => 'varchar(45)', ), ) ); $result = $xml->toArray(); $this->assertEqual($result, $expected); }
test that empty values do not casefold collapse @see http://code.cakephp.org/tickets/view/8 @return void
testCaseFoldingWithEmptyValues
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testMixedParsing() { $source = '<response><body><hello><![CDATA[happy world]]></hello><![CDATA[in between]]><goodbye><![CDATA[cruel world]]></goodbye></body></response>'; $xml = new Xml($source); $result = $xml->toString(); $this->assertEqual($source, $result); }
testMixedParsing method @access public @return void
testMixedParsing
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testComplexParsing() { $source = '<projects><project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry></project></projects>'; $xml = new Xml($source); $result = $xml->toString(array('cdata' => false)); $this->assertEqual($source, $result); }
testComplexParsing method @access public @return void
testComplexParsing
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testNamespaceParsing() { $source = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>'; $xml = new Xml($source); $result = $xml->toString(array('cdata' => false)); $this->assertEqual($source, $result); $children = $xml->children('container'); $this->assertEqual($children[0]->namespace, 'a'); $children = $children[0]->children('rule'); $this->assertEqual($children[0]->namespace, 'b'); }
testNamespaceParsing method @access public @return void
testNamespaceParsing
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testNamespaces() { $source = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>'; $xml = new Xml($source); $expects = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e" xmlns:f="http://example.com/f"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>'; $_xml =& XmlManager::getInstance(); $xml->addNamespace('f', 'http://example.com/f'); $result = $xml->toString(array('cdata' => false)); $this->assertEqual($expects, $result); }
testNamespaces method @access public @return void
testNamespaces
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testEscapeCharSerialization() { $xml = new Xml(array('text' => 'JavaScript & DHTML'), array('attributes' => false, 'format' => 'attributes')); $result = $xml->toString(false); $expected = '<std_class text="JavaScript &amp; DHTML" />'; $this->assertEqual($expected, $result); }
testEscapeCharSerialization method @access public @return void
testEscapeCharSerialization
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testCompleteEscapeCharSerialization() { $xml = new Xml(array('text' => '<>&"\''), array('attributes' => false, 'format' => 'attributes')); $result = $xml->toString(false); $expected = '<std_class text="&lt;&gt;&amp;&quot;&#039;" />'; $this->assertEqual($expected, $result); }
testCompleteEscapeCharSerialization method @access public @return void
testCompleteEscapeCharSerialization
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testToArray() { App::import('Set'); $string = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <rss version="2.0"> <channel> <title>Cake PHP Google Group</title> <link>http://groups.google.com/group/cake-php</link> <description>Search this group before posting anything. There are over 20,000 posts and it&amp;#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.</description> <language>en</language> <item> <title>constructng result array when using findall</title> <link>http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f</link> <description>i&#39;m using cakephp to construct a logical data model array that will be &lt;br&gt; passed to a flex app. I have the following model association: &lt;br&gt; ServiceDay-&amp;gt;(hasMany)ServiceTi me-&amp;gt;(hasMany)ServiceTimePrice. So what &lt;br&gt; the current output from my findall is something like this example: &lt;br&gt; &lt;p&gt;Array( &lt;br&gt; [0] =&amp;gt; Array(</description> <guid isPermaLink="true">http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f</guid> <author>[email protected](bpscrugs)</author> <pubDate>Fri, 28 Dec 2007 00:44:14 UT</pubDate> </item> <item> <title>Re: share views between actions?</title> <link>http://groups.google.com/group/cake-php/msg/8b350d898707dad8</link> <description>Then perhaps you might do us all a favour and refrain from replying to &lt;br&gt; things you do not understand. That goes especially for asinine comments. &lt;br&gt; Indeed. &lt;br&gt; To sum up: &lt;br&gt; No comment. &lt;br&gt; In my day, a simple &amp;quot;RTFM&amp;quot; would suffice. I&#39;ll keep in mind to ignore any &lt;br&gt; further responses from you. &lt;br&gt; You (and I) were referring to the *online documentation*, not other</description> <guid isPermaLink="true">http://groups.google.com/group/cake-php/msg/8b350d898707dad8</guid> <author>[email protected](subtropolis zijn)</author> <pubDate>Fri, 28 Dec 2007 00:45:01 UT</pubDate> </item> </channel> </rss>'; $xml = new Xml($string); $result = $xml->toArray(); $expected = array('Rss' => array( 'version' => '2.0', 'Channel' => array( 'title' => 'Cake PHP Google Group', 'link' => 'http://groups.google.com/group/cake-php', 'description' => 'Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.', 'language' => 'en', 'Item' => array( array( 'title' => 'constructng result array when using findall', 'link' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f', 'description' => "i'm using cakephp to construct a logical data model array that will be <br> passed to a flex app. I have the following model association: <br> ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what <br> the current output from my findall is something like this example: <br><p>Array( <br> [0] =&gt; Array(", 'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f'), 'author' => '[email protected](bpscrugs)', 'pubDate' => 'Fri, 28 Dec 2007 00:44:14 UT', ), array( 'title' => 'Re: share views between actions?', 'link' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8', 'description' => 'Then perhaps you might do us all a favour and refrain from replying to <br> things you do not understand. That goes especially for asinine comments. <br> Indeed. <br> To sum up: <br> No comment. <br> In my day, a simple &quot;RTFM&quot; would suffice. I\'ll keep in mind to ignore any <br> further responses from you. <br> You (and I) were referring to the *online documentation*, not other', 'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8'), 'author' => '[email protected](subtropolis zijn)', 'pubDate' => 'Fri, 28 Dec 2007 00:45:01 UT' ) ) ) )); $this->assertEqual($result, $expected); $string ='<data><post title="Title of this post" description="cool"/></data>'; $xml = new Xml($string); $result = $xml->toArray(); $expected = array('Data' => array('Post' => array('title' => 'Title of this post', 'description' => 'cool'))); $this->assertEqual($result, $expected); $xml = new Xml('<example><item><title>An example of a correctly reversed XMLNode</title><desc/></item></example>'); $result = Set::reverse($xml); $expected = array( 'Example' => array( 'Item' => array( 'title' => 'An example of a correctly reversed XMLNode', 'desc' => array(), ) ) ); $this->assertIdentical($result, $expected); $xml = new Xml('<example><item attr="123"><titles><title>title1</title><title>title2</title></titles></item></example>'); $result = $xml->toArray(); $expected = array( 'Example' => array( 'Item' => array( 'attr' => '123', 'Titles' => array( 'Title' => array('title1', 'title2') ) ) ) ); $this->assertIdentical($result, $expected); $xml = new Xml('<example attr="ex_attr"><item attr="123"><titles>list</titles>textforitems</item></example>'); $result = $xml->toArray(); $expected = array( 'Example' => array( 'attr' => 'ex_attr', 'Item' => array( 'attr' => '123', 'titles' => 'list', 'value' => 'textforitems' ) ) ); $this->assertIdentical($result, $expected); $xml = new Xml('<example attr="ex_attr"><item attr="123"><titles>list</titles>textforitems</item></example>'); $example = $xml->child('example'); $item = $example->child('item'); $result = $item->toArray(); $expected = array( 'attr' => '123', 'titles' => 'list', 'value' => 'textforitems' ); $this->assertIdentical($result, $expected); $string = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <rss version="2.0"> <channel> <title>Cake PHP Google Group</title> <link>http://groups.google.com/group/cake-php</link> <description>Search this group before posting anything. There are over 20,000 posts and it&amp;#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.</description> <language>en</language> <item> <title>constructng result array when using findall</title> <link>http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f</link> <description>i&#39;m using cakephp to construct a logical data model array that will be &lt;br&gt; passed to a flex app. I have the following model association: &lt;br&gt; ServiceDay-&amp;gt;(hasMany)ServiceTi me-&amp;gt;(hasMany)ServiceTimePrice. So what &lt;br&gt; the current output from my findall is something like this example: &lt;br&gt; &lt;p&gt;Array( &lt;br&gt; [0] =&amp;gt; Array(</description> <dc:creator>cakephp</dc:creator> <category><![CDATA[cakephp]]></category> <category><![CDATA[model]]></category> <guid isPermaLink="true">http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f</guid> <author>[email protected](bpscrugs)</author> <pubDate>Fri, 28 Dec 2007 00:44:14 UT</pubDate> </item> <item> <title>Re: share views between actions?</title> <link>http://groups.google.com/group/cake-php/msg/8b350d898707dad8</link> <description>Then perhaps you might do us all a favour and refrain from replying to &lt;br&gt; things you do not understand. That goes especially for asinine comments. &lt;br&gt; Indeed. &lt;br&gt; To sum up: &lt;br&gt; No comment. &lt;br&gt; In my day, a simple &amp;quot;RTFM&amp;quot; would suffice. I&#39;ll keep in mind to ignore any &lt;br&gt; further responses from you. &lt;br&gt; You (and I) were referring to the *online documentation*, not other</description> <dc:creator>cakephp</dc:creator> <category><![CDATA[cakephp]]></category> <category><![CDATA[model]]></category> <guid isPermaLink="true">http://groups.google.com/group/cake-php/msg/8b350d898707dad8</guid> <author>[email protected](subtropolis zijn)</author> <pubDate>Fri, 28 Dec 2007 00:45:01 UT</pubDate> </item> </channel> </rss>'; $xml = new Xml($string); $result = $xml->toArray(); $expected = array('Rss' => array( 'version' => '2.0', 'Channel' => array( 'title' => 'Cake PHP Google Group', 'link' => 'http://groups.google.com/group/cake-php', 'description' => 'Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database.', 'language' => 'en', 'Item' => array( array( 'title' => 'constructng result array when using findall', 'link' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f', 'description' => "i'm using cakephp to construct a logical data model array that will be <br> passed to a flex app. I have the following model association: <br> ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what <br> the current output from my findall is something like this example: <br><p>Array( <br> [0] =&gt; Array(", 'creator' => 'cakephp', 'Category' => array('cakephp', 'model'), 'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f'), 'author' => '[email protected](bpscrugs)', 'pubDate' => 'Fri, 28 Dec 2007 00:44:14 UT', ), array( 'title' => 'Re: share views between actions?', 'link' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8', 'description' => 'Then perhaps you might do us all a favour and refrain from replying to <br> things you do not understand. That goes especially for asinine comments. <br> Indeed. <br> To sum up: <br> No comment. <br> In my day, a simple &quot;RTFM&quot; would suffice. I\'ll keep in mind to ignore any <br> further responses from you. <br> You (and I) were referring to the *online documentation*, not other', 'creator' => 'cakephp', 'Category' => array('cakephp', 'model'), 'guid' => array('isPermaLink' => 'true', 'value' => 'http://groups.google.com/group/cake-php/msg/8b350d898707dad8'), 'author' => '[email protected](subtropolis zijn)', 'pubDate' => 'Fri, 28 Dec 2007 00:45:01 UT' ) ) ) )); $this->assertEqual($result, $expected); $text = "<?xml version='1.0' encoding='utf-8'?> <course> <comps> <comp>1</comp> <comp>2</comp> <comp>3</comp> <comp>4</comp> </comps> </course>"; $xml = new Xml($text); $result = $xml->toArray(); $expected = array('Course' => array( 'Comps' => array( 'Comp' => array( 1, 2, 3, 4 ) ) )); $this->assertEqual($result, $expected); $text = '<?xml version="1.0" encoding="UTF-8"?> <XRDS xmlns="xri://$xrds"> <XRD xml:id="oauth" xmlns="xri://$XRD*($v*2.0)" version="2.0"> <Type>xri://$xrds*simple</Type> <Expires>2008-04-13T07:34:58Z</Expires> <Service> <Type>http://oauth.net/core/1.0/endpoint/authorize</Type> <Type>http://oauth.net/core/1.0/parameters/auth-header</Type> <Type>http://oauth.net/core/1.0/parameters/uri-query</Type> <URI priority="10">https://ma.gnolia.com/oauth/authorize</URI> <URI priority="20">http://ma.gnolia.com/oauth/authorize</URI> </Service> </XRD> <XRD xmlns="xri://$XRD*($v*2.0)" version="2.0"> <Type>xri://$xrds*simple</Type> <Service priority="10"> <Type>http://oauth.net/discovery/1.0</Type> <URI>#oauth</URI> </Service> </XRD> </XRDS>'; $xml = new Xml($text); $result = $xml->toArray(); $expected = array('XRDS' => array( 'xmlns' => 'xri://$xrds', 'XRD' => array( array( 'xml:id' => 'oauth', 'xmlns' => 'xri://$XRD*($v*2.0)', 'version' => '2.0', 'Type' => 'xri://$xrds*simple', 'Expires' => '2008-04-13T07:34:58Z', 'Service' => array( 'Type' => array( 'http://oauth.net/core/1.0/endpoint/authorize', 'http://oauth.net/core/1.0/parameters/auth-header', 'http://oauth.net/core/1.0/parameters/uri-query' ), 'URI' => array( array( 'value' => 'https://ma.gnolia.com/oauth/authorize', 'priority' => '10', ), array( 'value' => 'http://ma.gnolia.com/oauth/authorize', 'priority' => '20' ) ) ) ), array( 'xmlns' => 'xri://$XRD*($v*2.0)', 'version' => '2.0', 'Type' => 'xri://$xrds*simple', 'Service' => array( 'priority' => '10', 'Type' => 'http://oauth.net/discovery/1.0', 'URI' => '#oauth' ) ) ) )); $this->assertEqual($result, $expected); $text = '<?xml version="1.0" encoding="UTF-8"?> <root> <child id="1" other="1" /> <child id="2" other="1" /> <child id="3" other="1" /> <child id="4" other="1" /> <child id="5" other="1" /> </root>'; $xml = new Xml($text); $result = $xml->toArray(); $expected = array( 'Root' => array( 'Child' => array( array('id' => 1, 'other' => 1), array('id' => 2, 'other' => 1), array('id' => 3, 'other' => 1), array('id' => 4, 'other' => 1), array('id' => 5, 'other' => 1) ) ) ); $this->assertEqual($result, $expected); $text = '<main><first label="first type node 1" /><first label="first type node 2" /><second label="second type node" /></main>'; $xml = new Xml($text); $result = $xml->toArray(); $expected = array( 'Main' => array( 'First' => array( array('label' => 'first type node 1'), array('label' => 'first type node 2') ), 'Second' => array('label'=>'second type node') ) ); $this->assertIdentical($result,$expected); $text = '<main><first label="first type node 1" /><first label="first type node 2" /><second label="second type node" /><collection><fifth label="fifth type node"/><third label="third type node 1"/><third label="third type node 2"/><third label="third type node 3"/><fourth label="fourth type node"/></collection></main>'; $xml = new Xml($text); $result = $xml->toArray(); $expected = array( 'Main' => array( 'First' => array( array('label' => 'first type node 1'), array('label' => 'first type node 2') ), 'Second' => array('label'=>'second type node'), 'Collection' => array( 'Fifth' => array('label' => 'fifth type node'), 'Third' => array( array('label' => 'third type node 1'), array('label' => 'third type node 2'), array('label' => 'third type node 3'), ), 'Fourth' => array('label' => 'fourth type node'), ) ) ); $this->assertIdentical($result,$expected); }
testToArray method @access public @return void
testToArray
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testAppend() { $parentNode = new XmlNode('ourParentNode'); $parentNode->append( new XmlNode('ourChildNode')); $first =& $parentNode->first(); $this->assertEqual($first->name, 'ourChildNode'); $string = 'ourChildNode'; $parentNode = new XmlNode('ourParentNode'); $parentNode->append($string); $last =& $parentNode->last(); $this->assertEqual($last->name, 'ourChildNode'); $this->expectError(); $parentNode->append($parentNode); }
testAppend method @access public @return void
testAppend
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testNamespacing() { $node = new Xml('<xml></xml>'); $node->addNamespace('cake', 'http://cakephp.org'); $this->assertEqual($node->toString(), '<xml xmlns:cake="http://cakephp.org" />'); $this->assertTrue($node->removeNamespace('cake')); $this->assertEqual($node->toString(), '<xml />'); $node = new Xml('<xml xmlns:cake="http://cakephp.org" />'); $this->assertTrue($node->removeNamespace('cake')); $this->assertEqual($node->toString(), '<xml />'); $node->addNamespace('cake', 'http://cakephp.org'); $this->assertEqual($node->toString(), '<xml xmlns:cake="http://cakephp.org" />'); }
testNamespacing method @access public @return void
testNamespacing
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testCamelize() { $xmlString = '<methodCall><methodName>examples.getStateName</methodName>' . '<params><param><value><i4>41</i4></value></param></params></methodCall>'; $Xml = new Xml($xmlString); $expected = array( 'methodCall' => array( 'methodName' => 'examples.getStateName', 'params' => array( 'param' => array('value' => array('i4' => 41))))); $this->assertEqual($expected, $Xml->toArray(false)); $Xml = new Xml($xmlString); $expected = array( 'MethodCall' => array( 'methodName' => 'examples.getStateName', 'Params' => array( 'Param' => array('Value' => array('i4' => 41))))); $this->assertEqual($expected, $Xml->toArray()); }
testCamelize method @access public @return void
testCamelize
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testNumericDataHandling() { $data = '<xml><data>012345</data></xml>'; $node = new Xml(); $node->load($data); $node->parse(); $result = $node->first(); $result = $result->children("data"); $result = $result[0]->first(); $this->assertEqual($result->value, '012345'); }
testNumericDataHandling method @access public @return void
testNumericDataHandling
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testMemoryLeakInConstructor() { if ($this->skipIf(!function_exists('memory_get_usage'), 'Cannot test memory leaks without memory_get_usage')) { return; } $data = '<?xml version="1.0" encoding="UTF-8"?><content>TEST</content>'; $start = memory_get_usage(); for ($i = 0; $i <= 300; $i++) { $test =& new XML($data); $test->__destruct(); unset($test); } $end = memory_get_usage(); $this->assertWithinMargin($start, $end, 3600, 'Memory leaked %s'); }
test that creating an xml object does not leak memory @return void
testMemoryLeakInConstructor
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function testToArrayAlternate() { $sXml = '<t1> <t2>A</t2> <t2><t3>AAA</t3>B</t2> <t2>C</t2> </t1>'; $xml = new Xml($sXml); $result = $xml->toArray(); $expected = array( 'T1' => array( 'T2' => array( 'A', array('t3' => 'AAA', 'value' => 'B'), 'C' ) ) ); $this->assertIdentical($result, $expected); $result = $xml->toArray(false); $expected = array( 't1' => array( 't2' => array( 'A', array('t3' => 'AAA', 'value' => 'B'), 'C' ) ) ); $this->assertIdentical($result, $expected); $sXml = '<t1> <t2>A</t2> <t2>B</t2> <t2> <t3>CCC</t3> </t2> </t1>'; $xml = new Xml($sXml); $result = $xml->toArray(); $expected = array( 'T1' => array( 'T2' => array( 'A', 'B', array('t3' => 'CCC'), ) ) ); $this->assertIdentical($result, $expected); $result = $xml->toArray(false); $expected = array( 't1' => array( 't2' => array( 'A', 'B', array('t3' => 'CCC'), ) ) ); $this->assertIdentical($result, $expected); $sXml = '<t1> <t2>A</t2> <t2></t2> <t2>C</t2> </t1>'; $xml = new Xml($sXml); $result = $xml->toArray(); $expected = array( 'T1' => array( 'T2' => array( 'A', array(), 'C' ) ) ); $this->assertIdentical($result, $expected); $result = $xml->toArray(false); $expected = array( 't1' => array( 't2' => array( 'A', array(), 'C' ) ) ); $this->assertIdentical($result, $expected); $sXml = '<stuff> <foo name="abc-16" profile-id="Default" /> <foo name="abc-17" profile-id="Default" > <bar id="HelloWorld" /> </foo> <foo name="abc-asdf" profile-id="Default" /> <foo name="cba-1A" profile-id="Default"> <bar id="Baz" /> </foo> <foo name="cba-2A" profile-id="Default"> <bar id="Baz" /> </foo> <foo name="qa" profile-id="Default" /> </stuff>'; $xml = new Xml($sXml); $result = $xml->toArray(); $expected = array( 'Stuff' => array( 'Foo' => array( array('name' => 'abc-16', 'profile-id' => 'Default'), array('name' => 'abc-17', 'profile-id' => 'Default', 'Bar' => array('id' => 'HelloWorld')), array('name' => 'abc-asdf', 'profile-id' => 'Default'), array('name' => 'cba-1A', 'profile-id' => 'Default', 'Bar' => array('id' => 'Baz')), array('name' => 'cba-2A', 'profile-id' => 'Default', 'Bar' => array('id' => 'Baz')), array('name' => 'qa', 'profile-id' => 'Default'), ) ) ); $this->assertIdentical($result, $expected); $result = $xml->toArray(false); $expected = array( 'stuff' => array( 'foo' => array( array('name' => 'abc-16', 'profile-id' => 'Default'), array('name' => 'abc-17', 'profile-id' => 'Default', 'bar' => array('id' => 'HelloWorld')), array('name' => 'abc-asdf', 'profile-id' => 'Default'), array('name' => 'cba-1A', 'profile-id' => 'Default', 'bar' => array('id' => 'Baz')), array('name' => 'cba-2A', 'profile-id' => 'Default', 'bar' => array('id' => 'Baz')), array('name' => 'qa', 'profile-id' => 'Default'), ) ) ); $this->assertIdentical($result, $expected); $sXml = '<root> <node name="first" /> <node name="second"><subnode name="first sub" /><subnode name="second sub" /></node> <node name="third" /> </root>'; $xml = new Xml($sXml); $result = $xml->toArray(); $expected = array( 'Root' => array( 'Node' => array( array('name' => 'first'), array('name' => 'second', 'Subnode' => array( array('name' => 'first sub'), array('name' => 'second sub'))), array('name' => 'third'), ) ) ); $this->assertIdentical($result, $expected); $result = $xml->toArray(false); $expected = array( 'root' => array( 'node' => array( array('name' => 'first'), array('name' => 'second', 'subnode' => array( array('name' => 'first sub'), array('name' => 'second sub'))), array('name' => 'third'), ) ) ); $this->assertIdentical($result, $expected); }
Test toArray with alternate inputs. @return void
testToArrayAlternate
php
Datawalke/Coordino
cake/tests/cases/libs/xml.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/xml.test.php
MIT
function skip() { $skip = true; if (function_exists('apc_store')) { $skip = false; } $this->skipIf($skip, '%s Apc is not installed or configured properly'); }
skip method @access public @return void
skip
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function setUp() { $this->_cacheDisable = Configure::read('Cache.disable'); Configure::write('Cache.disable', false); Cache::config('apc', array('engine' => 'Apc', 'prefix' => 'cake_')); }
setUp method @access public @return void
setUp
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function tearDown() { Configure::write('Cache.disable', $this->_cacheDisable); Cache::drop('apc'); Cache::config('default'); }
tearDown method @access public @return void
tearDown
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function testReadAndWriteCache() { Cache::set(array('duration' => 1)); $result = Cache::read('test'); $expecting = ''; $this->assertEqual($result, $expecting); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('test', $data); $this->assertTrue($result); $result = Cache::read('test'); $expecting = $data; $this->assertEqual($result, $expecting); Cache::delete('test'); }
testReadAndWriteCache method @access public @return void
testReadAndWriteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function testReadWriteDurationZero() { Cache::config('apc', array('engine' => 'Apc', 'duration' => 0, 'prefix' => 'cake_')); Cache::write('zero', 'Should save', 'apc'); sleep(1); $result = Cache::read('zero', 'apc'); $this->assertEqual('Should save', $result); }
Writing cache entries with duration = 0 (forever) should work. @return void
testReadWriteDurationZero
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function testExpiry() { Cache::set(array('duration' => 1)); $result = Cache::read('test'); $this->assertFalse($result); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); Cache::set(array('duration' => 1)); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); }
testExpiry method @access public @return void
testExpiry
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function testDeleteCache() { $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('delete_test', $data); $this->assertTrue($result); $result = Cache::delete('delete_test'); $this->assertTrue($result); }
testDeleteCache method @access public @return void
testDeleteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function testDecrement() { if ($this->skipIf(!function_exists('apc_dec'), 'No apc_dec() function, cannot test decrement() %s')) { return; } $result = Cache::write('test_decrement', 5); $this->assertTrue($result); $result = Cache::decrement('test_decrement'); $this->assertEqual(4, $result); $result = Cache::read('test_decrement'); $this->assertEqual(4, $result); $result = Cache::decrement('test_decrement', 2); $this->assertEqual(2, $result); $result = Cache::read('test_decrement'); $this->assertEqual(2, $result); }
testDecrement method @access public @return void
testDecrement
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function testIncrement() { if ($this->skipIf(!function_exists('apc_inc'), 'No apc_inc() function, cannot test increment() %s')) { return; } $result = Cache::write('test_increment', 5); $this->assertTrue($result); $result = Cache::increment('test_increment'); $this->assertEqual(6, $result); $result = Cache::read('test_increment'); $this->assertEqual(6, $result); $result = Cache::increment('test_increment', 2); $this->assertEqual(8, $result); $result = Cache::read('test_increment'); $this->assertEqual(8, $result); }
testIncrement method @access public @return void
testIncrement
php
Datawalke/Coordino
cake/tests/cases/libs/cache/apc.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/apc.test.php
MIT
function startCase() { $this->_cacheDisable = Configure::read('Cache.disable'); $this->_cacheConfig = Cache::config('default'); Configure::write('Cache.disable', false); Cache::config('default', array('engine' => 'File', 'path' => CACHE)); }
startCase method @access public @return void
startCase
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function endCase() { Configure::write('Cache.disable', $this->_cacheDisable); Cache::config('default', $this->_cacheConfig['settings']); }
endCase method @access public @return void
endCase
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testCacheDirChange() { $result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'sessions')); $this->assertEqual($result['settings'], Cache::settings('sessions')); $result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'tests')); $this->assertEqual($result['settings'], Cache::settings('sessions')); $this->assertNotEqual($result['settings'], Cache::settings('default')); }
testCacheDirChange method @access public @return void
testCacheDirChange
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testReadAndWriteCache() { Cache::config('default'); $result = Cache::write(null, 'here'); $this->assertFalse($result); Cache::set(array('duration' => 1)); $result = Cache::read('test'); $expecting = ''; $this->assertEqual($result, $expecting); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('test', $data); $this->assertTrue(file_exists(CACHE . 'cake_test')); $result = Cache::read('test'); $expecting = $data; $this->assertEqual($result, $expecting); Cache::delete('test'); }
testReadAndWriteCache method @access public @return void
testReadAndWriteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testExpiry() { Cache::set(array('duration' => 1)); $result = Cache::read('test'); $this->assertFalse($result); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); Cache::set(array('duration' => "+1 second")); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); }
testExpiry method @access public @return void
testExpiry
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testDeleteCache() { $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('delete_test', $data); $this->assertTrue($result); $result = Cache::delete('delete_test'); $this->assertTrue($result); $this->assertFalse(file_exists(TMP . 'tests' . DS . 'delete_test')); $result = Cache::delete('delete_test'); $this->assertFalse($result); }
testDeleteCache method @access public @return void
testDeleteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testSerialize() { Cache::config('default', array('engine' => 'File', 'serialize' => true)); $data = 'this is a test of the emergency broadcasting system'; $write = Cache::write('serialize_test', $data); $this->assertTrue($write); Cache::config('default', array('serialize' => false)); $read = Cache::read('serialize_test'); $newread = Cache::read('serialize_test'); $delete = Cache::delete('serialize_test'); $this->assertIdentical($read, serialize($data)); $this->assertIdentical(unserialize($newread), $data); }
testSerialize method @access public @return void
testSerialize
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testClear() { Cache::config('default', array('engine' => 'File', 'duration' => 1)); $data = 'this is a test of the emergency broadcasting system'; $write = Cache::write('serialize_test1', $data); $write = Cache::write('serialize_test2', $data); $write = Cache::write('serialize_test3', $data); $this->assertTrue(file_exists(CACHE . 'cake_serialize_test1')); $this->assertTrue(file_exists(CACHE . 'cake_serialize_test2')); $this->assertTrue(file_exists(CACHE . 'cake_serialize_test3')); sleep(2); $result = Cache::clear(true); $this->assertTrue($result); $this->assertFalse(file_exists(CACHE . 'cake_serialize_test1')); $this->assertFalse(file_exists(CACHE . 'cake_serialize_test2')); $this->assertFalse(file_exists(CACHE . 'cake_serialize_test3')); $data = 'this is a test of the emergency broadcasting system'; $write = Cache::write('serialize_test1', $data); $write = Cache::write('serialize_test2', $data); $write = Cache::write('serialize_test3', $data); $this->assertTrue(file_exists(CACHE . 'cake_serialize_test1')); $this->assertTrue(file_exists(CACHE . 'cake_serialize_test2')); $this->assertTrue(file_exists(CACHE . 'cake_serialize_test3')); $result = Cache::clear(); $this->assertTrue($result); $this->assertFalse(file_exists(CACHE . 'cake_serialize_test1')); $this->assertFalse(file_exists(CACHE . 'cake_serialize_test2')); $this->assertFalse(file_exists(CACHE . 'cake_serialize_test3')); Cache::config('default', array('engine' => 'File', 'path' => CACHE . 'views')); $data = 'this is a test of the emergency broadcasting system'; $write = Cache::write('controller_view_1', $data); $write = Cache::write('controller_view_2', $data); $write = Cache::write('controller_view_3', $data); $write = Cache::write('controller_view_10', $data); $write = Cache::write('controller_view_11', $data); $write = Cache::write('controller_view_12', $data); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12')); clearCache('controller_view_1', 'views', ''); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12')); clearCache('controller_view', 'views', ''); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12')); $write = Cache::write('controller_view_1', $data); $write = Cache::write('controller_view_2', $data); $write = Cache::write('controller_view_3', $data); $write = Cache::write('controller_view_10', $data); $write = Cache::write('controller_view_11', $data); $write = Cache::write('controller_view_12', $data); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12')); clearCache(array('controller_view_2', 'controller_view_11', 'controller_view_12'), 'views', ''); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3')); $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11')); $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12')); clearCache('controller_view'); Cache::config('default', array('engine' => 'File', 'path' => CACHE)); }
testClear method @access public @return void
testClear
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testClearWithPrefixes() { $FileOne =& new FileEngine(); $FileOne->init(array( 'prefix' => 'prefix_one_', 'duration' => DAY )); $FileTwo =& new FileEngine(); $FileTwo->init(array( 'prefix' => 'prefix_two_', 'duration' => DAY )); $data1 = $data2 = $expected = 'content to cache'; $FileOne->write('key_one', $data1, DAY); $FileTwo->write('key_two', $data2, DAY); $this->assertEqual($FileOne->read('key_one'), $expected); $this->assertEqual($FileTwo->read('key_two'), $expected); $FileOne->clear(false); $this->assertEqual($FileTwo->read('key_two'), $expected, 'secondary config was cleared by accident.'); }
test that clear() doesn't wipe files not in the current engine's prefix. @return void
testClearWithPrefixes
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testKeyPath() { $result = Cache::write('views.countries.something', 'here'); $this->assertTrue($result); $this->assertTrue(file_exists(CACHE . 'cake_views_countries_something')); $result = Cache::read('views.countries.something'); $this->assertEqual($result, 'here'); $result = Cache::clear(); $this->assertTrue($result); }
testKeyPath method @access public @return void
testKeyPath
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testRemoveWindowsSlashesFromCache() { Cache::config('windows_test', array('engine' => 'File', 'isWindows' => true, 'prefix' => null, 'path' => TMP)); $expected = array ( 'C:\dev\prj2\sites\cake\libs' => array( 0 => 'C:\dev\prj2\sites\cake\libs', 1 => 'C:\dev\prj2\sites\cake\libs\view', 2 => 'C:\dev\prj2\sites\cake\libs\view\scaffolds', 3 => 'C:\dev\prj2\sites\cake\libs\view\pages', 4 => 'C:\dev\prj2\sites\cake\libs\view\layouts', 5 => 'C:\dev\prj2\sites\cake\libs\view\layouts\xml', 6 => 'C:\dev\prj2\sites\cake\libs\view\layouts\rss', 7 => 'C:\dev\prj2\sites\cake\libs\view\layouts\js', 8 => 'C:\dev\prj2\sites\cake\libs\view\layouts\email', 9 => 'C:\dev\prj2\sites\cake\libs\view\layouts\email\text', 10 => 'C:\dev\prj2\sites\cake\libs\view\layouts\email\html', 11 => 'C:\dev\prj2\sites\cake\libs\view\helpers', 12 => 'C:\dev\prj2\sites\cake\libs\view\errors', 13 => 'C:\dev\prj2\sites\cake\libs\view\elements', 14 => 'C:\dev\prj2\sites\cake\libs\view\elements\email', 15 => 'C:\dev\prj2\sites\cake\libs\view\elements\email\text', 16 => 'C:\dev\prj2\sites\cake\libs\view\elements\email\html', 17 => 'C:\dev\prj2\sites\cake\libs\model', 18 => 'C:\dev\prj2\sites\cake\libs\model\datasources', 19 => 'C:\dev\prj2\sites\cake\libs\model\datasources\dbo', 20 => 'C:\dev\prj2\sites\cake\libs\model\behaviors', 21 => 'C:\dev\prj2\sites\cake\libs\controller', 22 => 'C:\dev\prj2\sites\cake\libs\controller\components', 23 => 'C:\dev\prj2\sites\cake\libs\cache'), 'C:\dev\prj2\sites\main_site\vendors' => array( 0 => 'C:\dev\prj2\sites\main_site\vendors', 1 => 'C:\dev\prj2\sites\main_site\vendors\shells', 2 => 'C:\dev\prj2\sites\main_site\vendors\shells\templates', 3 => 'C:\dev\prj2\sites\main_site\vendors\shells\templates\cdc_project', 4 => 'C:\dev\prj2\sites\main_site\vendors\shells\tasks', 5 => 'C:\dev\prj2\sites\main_site\vendors\js', 6 => 'C:\dev\prj2\sites\main_site\vendors\css'), 'C:\dev\prj2\sites\vendors' => array( 0 => 'C:\dev\prj2\sites\vendors', 1 => 'C:\dev\prj2\sites\vendors\simpletest', 2 => 'C:\dev\prj2\sites\vendors\simpletest\test', 3 => 'C:\dev\prj2\sites\vendors\simpletest\test\support', 4 => 'C:\dev\prj2\sites\vendors\simpletest\test\support\collector', 5 => 'C:\dev\prj2\sites\vendors\simpletest\extensions', 6 => 'C:\dev\prj2\sites\vendors\simpletest\extensions\testdox', 7 => 'C:\dev\prj2\sites\vendors\simpletest\docs', 8 => 'C:\dev\prj2\sites\vendors\simpletest\docs\fr', 9 => 'C:\dev\prj2\sites\vendors\simpletest\docs\en'), 'C:\dev\prj2\sites\main_site\views\helpers' => array( 0 => 'C:\dev\prj2\sites\main_site\views\helpers') ); Cache::write('test_dir_map', $expected, 'windows_test'); $data = Cache::read('test_dir_map', 'windows_test'); Cache::delete('test_dir_map', 'windows_test'); $this->assertEqual($expected, $data); Cache::drop('windows_test'); }
testRemoveWindowsSlashesFromCache method @access public @return void
testRemoveWindowsSlashesFromCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testWriteQuotedString() { Cache::config('default', array('engine' => 'File', 'path' => TMP . 'tests')); Cache::write('App.doubleQuoteTest', '"this is a quoted string"'); $this->assertIdentical(Cache::read('App.doubleQuoteTest'), '"this is a quoted string"'); Cache::write('App.singleQuoteTest', "'this is a quoted string'"); $this->assertIdentical(Cache::read('App.singleQuoteTest'), "'this is a quoted string'"); Cache::config('default', array('isWindows' => true, 'path' => TMP . 'tests')); $this->assertIdentical(Cache::read('App.doubleQuoteTest'), '"this is a quoted string"'); Cache::write('App.singleQuoteTest', "'this is a quoted string'"); $this->assertIdentical(Cache::read('App.singleQuoteTest'), "'this is a quoted string'"); }
testWriteQuotedString method @access public @return void
testWriteQuotedString
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function testErrorWhenPathDoesNotExist() { if ($this->skipIf(is_dir(TMP . 'tests' . DS . 'file_failure'), 'Cannot run test directory exists. %s')) { return; } $this->expectError(); Cache::config('failure', array( 'engine' => 'File', 'path' => TMP . 'tests' . DS . 'file_failure' )); Cache::drop('failure'); }
check that FileEngine generates an error when a configured Path does not exist. @return void
testErrorWhenPathDoesNotExist
php
Datawalke/Coordino
cake/tests/cases/libs/cache/file.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/file.test.php
MIT
function parseServerString($server) { return $this->_parseServerString($server); }
public accessor to _parseServerString @param string $server @return array
parseServerString
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function skip() { $skip = true; if (class_exists('Memcache')) { $skip = false; } $this->skipIf($skip, '%s Memcache is not installed or configured properly.'); }
skip method @access public @return void
skip
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function setUp() { $this->_cacheDisable = Configure::read('Cache.disable'); Configure::write('Cache.disable', false); Cache::config('memcache', array( 'engine' => 'Memcache', 'prefix' => 'cake_', 'duration' => 3600 )); }
setUp method @access public @return void
setUp
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function tearDown() { Configure::write('Cache.disable', $this->_cacheDisable); Cache::drop('memcache'); Cache::config('default'); }
tearDown method @access public @return void
tearDown
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testSettings() { $settings = Cache::settings(); unset($settings['serialize'], $settings['path']); $expecting = array( 'prefix' => 'cake_', 'duration'=> 3600, 'probability' => 100, 'servers' => array('127.0.0.1'), 'compress' => false, 'engine' => 'Memcache', 'persistent' => true, ); $this->assertEqual($settings, $expecting); }
testSettings method @access public @return void
testSettings
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testMultipleServers() { $servers = array('127.0.0.1:11211', '127.0.0.1:11222'); $available = true; $Memcache =& new Memcache(); foreach($servers as $server) { list($host, $port) = explode(':', $server); if (!@$Memcache->connect($host, $port)) { $available = false; } } if ($this->skipIf(!$available, '%s Need memcache servers at ' . implode(', ', $servers) . ' to run this test')) { return; } $Memcache =& new MemcacheEngine(); $Memcache->init(array('engine' => 'Memcache', 'servers' => $servers)); $servers = array_keys($Memcache->__Memcache->getExtendedStats()); $settings = $Memcache->settings(); $this->assertEqual($servers, $settings['servers']); Cache::drop('dual_server'); }
testSettings method @access public @return void
testMultipleServers
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testConnect() { $Memcache =& new MemcacheEngine(); $Memcache->init(Cache::settings('memcache')); $result = $Memcache->connect('127.0.0.1'); $this->assertTrue($result); }
testConnect method @access public @return void
testConnect
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testConnectIpv6() { $Memcache =& new MemcacheEngine(); $result = $Memcache->init(array( 'prefix' => 'cake_', 'duration' => 200, 'engine' => 'Memcache', 'servers' => array( '[::1]:11211' ) )); $this->assertTrue($result); }
test connecting to an ipv6 server. @return void
testConnectIpv6
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testReadAndWriteCache() { Cache::set(array('duration' => 1)); $result = Cache::read('test'); $expecting = ''; $this->assertEqual($result, $expecting); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('test', $data); $this->assertTrue($result); $result = Cache::read('test'); $expecting = $data; $this->assertEqual($result, $expecting); Cache::delete('test'); }
testReadAndWriteCache method @access public @return void
testReadAndWriteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testExpiry() { Cache::set(array('duration' => 1)); $result = Cache::read('test'); $this->assertFalse($result); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); Cache::set(array('duration' => "+1 second")); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); Cache::config('memcache', array('duration' => '+1 second')); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); Cache::config('memcache', array('duration' => '+29 days')); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('long_expiry_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('long_expiry_test'); $expecting = $data; $this->assertEqual($result, $expecting); Cache::config('memcache', array('duration' => 3600)); }
testExpiry method @access public @return void
testExpiry
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testDeleteCache() { $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('delete_test', $data); $this->assertTrue($result); $result = Cache::delete('delete_test'); $this->assertTrue($result); }
testDeleteCache method @access public @return void
testDeleteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testDecrement() { $result = Cache::write('test_decrement', 5); $this->assertTrue($result); $result = Cache::decrement('test_decrement'); $this->assertEqual(4, $result); $result = Cache::read('test_decrement'); $this->assertEqual(4, $result); $result = Cache::decrement('test_decrement', 2); $this->assertEqual(2, $result); $result = Cache::read('test_decrement'); $this->assertEqual(2, $result); }
testDecrement method @access public @return void
testDecrement
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testIncrement() { $result = Cache::write('test_increment', 5); $this->assertTrue($result); $result = Cache::increment('test_increment'); $this->assertEqual(6, $result); $result = Cache::read('test_increment'); $this->assertEqual(6, $result); $result = Cache::increment('test_increment', 2); $this->assertEqual(8, $result); $result = Cache::read('test_increment'); $this->assertEqual(8, $result); }
testIncrement method @access public @return void
testIncrement
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testConfigurationConflict() { Cache::config('long_memcache', array( 'engine' => 'Memcache', 'duration'=> '+2 seconds', 'servers' => array('127.0.0.1:11211'), )); Cache::config('short_memcache', array( 'engine' => 'Memcache', 'duration'=> '+1 seconds', 'servers' => array('127.0.0.1:11211'), )); Cache::config('some_file', array('engine' => 'File')); $this->assertTrue(Cache::write('duration_test', 'yay', 'long_memcache')); $this->assertTrue(Cache::write('short_duration_test', 'boo', 'short_memcache')); $this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s'); $this->assertEqual(Cache::read('short_duration_test', 'short_memcache'), 'boo', 'Value was not read %s'); sleep(1); $this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s'); sleep(2); $this->assertFalse(Cache::read('short_duration_test', 'short_memcache'), 'Cache was not invalidated %s'); $this->assertFalse(Cache::read('duration_test', 'long_memcache'), 'Value did not expire %s'); Cache::delete('duration_test', 'long_memcache'); Cache::delete('short_duration_test', 'short_memcache'); }
test that configurations don't conflict, when a file engine is declared after a memcache one. @return void
testConfigurationConflict
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testZeroDuration() { Cache::config('memcache', array('duration' => 0)); $result = Cache::write('test_key', 'written!', 'memcache'); $this->assertTrue($result, 'Could not write with duration 0'); $result = Cache::read('test_key', 'memcache'); $this->assertEqual($result, 'written!'); }
test that a 0 duration can succesfully write. @return void
testZeroDuration
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function testLongDurationEqualToZero() { $memcache =& new TestMemcacheEngine(); $memcache->settings['compress'] = false; $mock = new MemcacheMockMemcache(); $memcache->setMemcache($mock); $mock->expectAt(0, 'set', array('key', 'value', false, 0)); $value = 'value'; $memcache->write('key', $value, 50 * DAY); }
test that durations greater than 30 days never expire @return void
testLongDurationEqualToZero
php
Datawalke/Coordino
cake/tests/cases/libs/cache/memcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/memcache.test.php
MIT
function skip() { $skip = true; if (function_exists('xcache_set')) { $skip = false; } $this->skipIf($skip, '%s Xcache is not installed or configured properly'); }
skip method @access public @return void
skip
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function setUp() { $this->_cacheDisable = Configure::read('Cache.disable'); Configure::write('Cache.disable', false); Cache::config('xcache', array('engine' => 'Xcache', 'prefix' => 'cake_')); }
setUp method @access public @return void
setUp
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function tearDown() { Configure::write('Cache.disable', $this->_cacheDisable); Cache::config('default'); }
tearDown method @access public @return void
tearDown
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function testSettings() { $settings = Cache::settings(); $expecting = array( 'prefix' => 'cake_', 'duration'=> 3600, 'probability' => 100, 'engine' => 'Xcache', ); $this->assertTrue(isset($settings['PHP_AUTH_USER'])); $this->assertTrue(isset($settings['PHP_AUTH_PW'])); unset($settings['PHP_AUTH_USER'], $settings['PHP_AUTH_PW']); $this->assertEqual($settings, $expecting); }
testSettings method @access public @return void
testSettings
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function testReadAndWriteCache() { Cache::set(array('duration' => 1)); $result = Cache::read('test'); $expecting = ''; $this->assertEqual($result, $expecting); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('test', $data); $this->assertTrue($result); $result = Cache::read('test'); $expecting = $data; $this->assertEqual($result, $expecting); Cache::delete('test'); }
testReadAndWriteCache method @access public @return void
testReadAndWriteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function testExpiry() { Cache::set(array('duration' => 1)); $result = Cache::read('test'); $this->assertFalse($result); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); Cache::set(array('duration' => "+1 second")); $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('other_test', $data); $this->assertTrue($result); sleep(2); $result = Cache::read('other_test'); $this->assertFalse($result); }
testExpiry method @access public @return void
testExpiry
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function testDeleteCache() { $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('delete_test', $data); $this->assertTrue($result); $result = Cache::delete('delete_test'); $this->assertTrue($result); }
testDeleteCache method @access public @return void
testDeleteCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function testClearCache() { $data = 'this is a test of the emergency broadcasting system'; $result = Cache::write('clear_test_1', $data); $this->assertTrue($result); $result = Cache::write('clear_test_2', $data); $this->assertTrue($result); $result = Cache::clear(); $this->assertTrue($result); }
testClearCache method @access public @return void
testClearCache
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function testDecrement() { $result = Cache::write('test_decrement', 5); $this->assertTrue($result); $result = Cache::decrement('test_decrement'); $this->assertEqual(4, $result); $result = Cache::read('test_decrement'); $this->assertEqual(4, $result); $result = Cache::decrement('test_decrement', 2); $this->assertEqual(2, $result); $result = Cache::read('test_decrement'); $this->assertEqual(2, $result); }
testDecrement method @access public @return void
testDecrement
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function testIncrement() { $result = Cache::write('test_increment', 5); $this->assertTrue($result); $result = Cache::increment('test_increment'); $this->assertEqual(6, $result); $result = Cache::read('test_increment'); $this->assertEqual(6, $result); $result = Cache::increment('test_increment', 2); $this->assertEqual(8, $result); $result = Cache::read('test_increment'); $this->assertEqual(8, $result); }
testIncrement method @access public @return void
testIncrement
php
Datawalke/Coordino
cake/tests/cases/libs/cache/xcache.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/cache/xcache.test.php
MIT
function initialize(&$controller, $settings) { foreach ($settings as $key => $value) { if (is_numeric($key)) { $this->{$value} = true; } else { $this->{$key} = $value; } } }
initialize method @param mixed $controller @param mixed $settings @access public @return void
initialize
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function startup(&$controller) { $this->testName = $controller->name; }
startup method @param mixed $controller @access public @return void
startup
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function initialize(&$controller, $settings) { $this->Controller = $controller; $this->Banana->testField = 'OrangeField'; $this->settings = $settings; }
initialize method @param mixed $controller @access public @return void
initialize
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function startup(&$controller) { $controller->foo = 'pass'; }
startup method @param Controller $controller @return string @access public
startup
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function startup(&$controller) { $controller->bar = 'fail'; }
startup method @param Controller $controller @return string @access public
startup
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function setUp() { $this->_pluginPaths = App::path('plugins'); App::build(array( 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) )); }
setUp method @access public @return void
setUp
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function tearDown() { App::build(); ClassRegistry::flush(); }
tearDown method @access public @return void
tearDown
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function testLoadComponents() { $Controller =& new ComponentTestController(); $Controller->components = array('RequestHandler'); $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent')); $Controller =& new ComponentTestController(); $Controller->plugin = 'test_plugin'; $Controller->components = array('RequestHandler', 'TestPluginComponent'); $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent')); $this->assertTrue(is_a($Controller->TestPluginComponent, 'TestPluginComponentComponent')); $this->assertTrue(is_a( $Controller->TestPluginComponent->TestPluginOtherComponent, 'TestPluginOtherComponentComponent' )); $this->assertFalse(isset($Controller->TestPluginOtherComponent)); $Controller =& new ComponentTestController(); $Controller->components = array('Security'); $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->Security, 'SecurityComponent')); $this->assertTrue(is_a($Controller->Security->Session, 'SessionComponent')); $Controller =& new ComponentTestController(); $Controller->components = array('Security', 'Cookie', 'RequestHandler'); $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->Security, 'SecurityComponent')); $this->assertTrue(is_a($Controller->Security->RequestHandler, 'RequestHandlerComponent')); $this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent')); $this->assertTrue(is_a($Controller->Cookie, 'CookieComponent')); }
testLoadComponents method @access public @return void
testLoadComponents
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function testComponentStartup() { $Controller =& new ComponentTestController(); $Controller->components = array('Apple'); $Controller->uses = false; $Controller->constructClasses(); $Controller->Component->initialize($Controller); $Controller->beforeFilter(); $Controller->Component->startup($Controller); $this->assertTrue(is_a($Controller->Apple, 'AppleComponent')); $this->assertEqual($Controller->Apple->testName, 'ComponentTest'); $expected = !(defined('APP_CONTROLLER_EXISTS') && APP_CONTROLLER_EXISTS); $this->assertEqual(isset($Controller->foo), $expected); $this->assertFalse(isset($Controller->bar)); }
Tests Component::startup() and only running callbacks for components directly attached to the controller. @return void
testComponentStartup
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function testTriggerCallback() { $Controller =& new ComponentTestController(); $Controller->components = array('ComponentMock'); $Controller->uses = null; $Controller->constructClasses(); $Controller->ComponentMock->expectOnce('beforeRender'); $Controller->Component->triggerCallback('beforeRender', $Controller); $Controller->ComponentMock->expectNever('beforeFilter'); $Controller->ComponentMock->enabled = false; $Controller->Component->triggerCallback('beforeFilter', $Controller); }
test that triggerCallbacks fires methods on all the components, and can trigger any method. @return void
testTriggerCallback
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT
function testMultipleComponentInitialize() { $Controller =& new ComponentTestController(); $Controller->uses = false; $Controller->components = array('Orange', 'Banana'); $Controller->constructClasses(); $Controller->Component->initialize($Controller); $this->assertEqual($Controller->Banana->testField, 'OrangeField'); $this->assertEqual($Controller->Orange->Banana->testField, 'OrangeField'); }
test a component being used more than once. @return void
testMultipleComponentInitialize
php
Datawalke/Coordino
cake/tests/cases/libs/controller/component.test.php
https://github.com/Datawalke/Coordino/blob/master/cake/tests/cases/libs/controller/component.test.php
MIT