public function testNormalizeLabel() { $this->assertSame("VariableName", \r8\Template\Access::normalizeLabel("Variable Name")); try { \r8\Template\Access::normalizeLabel("50Label"); $this->fail('An expected exception was not thrown'); } catch (\r8\Exception\Argument $err) { $this->assertSame("Must be a valid PHP variable name", $err->getMessage()); } }
/** * Adds a page to this list of pages to render * * @param String The variable name to inject this page as * @param \r8\iface\Page $page The page to add * @return \r8\Page\Collection Returns a self reference */ public function addPage($index, \r8\iface\Page $page) { $index = \r8\Template\Access::normalizeLabel($index); $this->pages[$index] = $page; return $this; }