/**
  * Converts this template to a string
  *
  *@throws Exception If there was a problem.
  *
  * @return string The string representation of this template.
  */
 public function toString()
 {
     ob_start();
     extract($this->_source);
     include realpath($this->_path);
     $result = ob_get_contents();
     ob_end_clean();
     return org_tubepress_impl_util_StringUtils::removeEmptyLines($result);
 }
 public function test()
 {
     ${org_tubepress_impl_options_ui_fields_AbstractOptionDescriptorBasedField::TEMPLATE_VAR_NAME} = 'some-name';
     ${org_tubepress_impl_options_ui_fields_AbstractOptionDescriptorBasedField::TEMPLATE_VAR_VALUE} = 'some-value';
     ob_start();
     include BASE . '/sys/ui/templates/options_page/fields/text.tpl.php';
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertEquals(org_tubepress_impl_util_StringUtils::removeEmptyLines($this->_expected()), org_tubepress_impl_util_StringUtils::removeEmptyLines($result));
 }
 public function test()
 {
     ${org_tubepress_impl_options_ui_fields_AbstractOptionDescriptorBasedField::TEMPLATE_VAR_NAME} = 'some-name';
     ${org_tubepress_impl_options_ui_fields_AbstractOptionDescriptorBasedField::TEMPLATE_VAR_VALUE} = 'poo';
     ${org_tubepress_impl_options_ui_fields_DropdownField::TEMPLATE_VAR_ACCEPTABLE_VALUES} = array('crack' => 'rock', 'poo' => 'some-value', 'pretzels' => 'jets');
     ob_start();
     include BASE . '/sys/ui/templates/options_page/fields/dropdown.tpl.php';
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertEquals(org_tubepress_impl_util_StringUtils::removeEmptyLines($this->_expected()), org_tubepress_impl_util_StringUtils::removeEmptyLines($result));
 }
 public function test()
 {
     $tab1 = \Mockery::mock(org_tubepress_spi_options_ui_Tab::_);
     $tab1->shouldReceive('getTitle')->times(3)->andReturn('title1');
     $tab1->shouldReceive('getHtml')->once()->andReturn('html1');
     $tab2 = \Mockery::mock(org_tubepress_spi_options_ui_Tab::_);
     $tab2->shouldReceive('getTitle')->times(3)->andReturn('title2');
     $tab2->shouldReceive('getHtml')->once()->andReturn('html2');
     ${org_tubepress_impl_options_ui_DefaultTabsHandler::TEMPLATE_VAR_TABS} = array($tab1, $tab2);
     ob_start();
     include BASE . '/sys/ui/templates/options_page/tabs.tpl.php';
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertEquals(org_tubepress_impl_util_StringUtils::removeEmptyLines($this->_expected()), org_tubepress_impl_util_StringUtils::removeEmptyLines($result));
     //$this->assertEquals($this->_removeNewLines($this->_expected()), $this->_removeNewLines($result));
 }
Example #5
0
 public function test()
 {
     $one = \Mockery::mock(org_tubepress_spi_options_ui_Field::_);
     $one->shouldReceive('getHtml')->once()->andReturn('one-html');
     $one->shouldReceive('getTitle')->once()->andReturn('one-title');
     $one->shouldReceive('getDescription')->once()->andReturn('one-description');
     $one->shouldReceive('isProOnly')->once()->andReturn(true);
     $one->shouldReceive('getArrayOfApplicableProviderNames')->once()->andReturn(array('foo', 'bar'));
     $two = \Mockery::mock(org_tubepress_spi_options_ui_Field::_);
     $two->shouldReceive('getHtml')->once()->andReturn('two-html');
     $two->shouldReceive('getTitle')->once()->andReturn('two-title');
     $two->shouldReceive('getDescription')->once()->andReturn('two-description');
     $two->shouldReceive('isProOnly')->once()->andReturn(false);
     $two->shouldReceive('getArrayOfApplicableProviderNames')->once()->andReturn(array());
     ${org_tubepress_impl_options_ui_tabs_AbstractTab::TEMPLATE_VAR_WIDGETARRAY} = array($one, $two);
     ob_start();
     include BASE . '/sys/ui/templates/options_page/tab.tpl.php';
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertEquals(org_tubepress_impl_util_StringUtils::removeEmptyLines($this->_expected()), org_tubepress_impl_util_StringUtils::removeEmptyLines($result));
 }
 public function test()
 {
     $one = \Mockery::mock(org_tubepress_api_options_OptionDescriptor::_);
     $two = \Mockery::mock(org_tubepress_api_options_OptionDescriptor::_);
     $three = \Mockery::mock(org_tubepress_api_options_OptionDescriptor::_);
     $one->shouldReceive('getName')->atLeast()->once()->andReturn('name-one');
     $two->shouldReceive('getName')->atLeast()->once()->andReturn('name-two');
     $one->shouldReceive('getLabel')->atLeast()->once()->andReturn('label-one');
     $two->shouldReceive('getLabel')->atLeast()->once()->andReturn('label-two');
     $three->shouldReceive('getName')->atLeast()->once()->andReturn('name-three');
     $three->shouldReceive('getLabel')->atLeast()->once()->andReturn('label-three');
     $descriptors = array($one, $two, $three);
     ${org_tubepress_impl_options_ui_fields_AbstractMultiSelectField::TEMPLATE_VAR_NAME} = 'some-name';
     ${org_tubepress_impl_options_ui_fields_AbstractMultiSelectField::TEMPLATE_VAR_DESCRIPTORS} = $descriptors;
     ${org_tubepress_impl_options_ui_fields_AbstractMultiSelectField::TEMPLATE_VAR_CURRENTVALUES} = array('crack', 'name-one', 'pittsburgh', 'steelers', 'name-three');
     ob_start();
     include BASE . '/sys/ui/templates/options_page/fields/multiselect.tpl.php';
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertEquals(org_tubepress_impl_util_StringUtils::removeEmptyLines($this->_expected()), org_tubepress_impl_util_StringUtils::removeEmptyLines($result));
 }
Example #7
0
 function testRemoveEmptyLines()
 {
     $val = "\n\n\t\ttest\n\n\t\ttwo\n\n\t\tthree\n\t\t";
     $this->assertEquals("\n\t\ttest\n\t\ttwo\n\t\tthree\n\t\t", org_tubepress_impl_util_StringUtils::removeEmptyLines($val));
 }