• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CSSContentParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CSSContentParser的典型用法代码示例。如果您正苦于以下问题:PHP CSSContentParser类的具体用法?PHP CSSContentParser怎么用?PHP CSSContentParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CSSContentParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testResizedImageInsertion

 public function testResizedImageInsertion()
 {
     $obj = new HtmlEditorFieldTest_Object();
     $editor = new HtmlEditorField('Content');
     /*
      * Following stuff is neccessary to
      *     a) use the proper filename for the image we are referencing
      *     b) not confuse the "existing" filesystem by our test
      */
     $imageFile = $this->objFromFixture('Image', 'example_image');
     $imageFile->Filename = FRAMEWORK_DIR . '/' . $imageFile->Filename;
     $origUpdateFilesystem = Config::inst()->get('File', 'update_filesystem');
     Config::inst()->update('File', 'update_filesystem', false);
     $imageFile->write();
     Config::inst()->update('File', 'update_filesystem', $origUpdateFilesystem);
     /*
      * End of test bet setting
      */
     $editor->setValue('<img src="assets/HTMLEditorFieldTest_example.jpg" width="10" height="20" />');
     $editor->saveInto($obj);
     $parser = new CSSContentParser($obj->Content);
     $xml = $parser->getByXpath('//img');
     $this->assertEquals('', (string) $xml[0]['alt'], 'Alt tags are added by default.');
     $this->assertEquals('', (string) $xml[0]['title'], 'Title tags are added by default.');
     $this->assertEquals(10, (int) $xml[0]['width'], 'Width tag of resized image is set.');
     $this->assertEquals(20, (int) $xml[0]['height'], 'Height tag of resized image is set.');
     $neededFilename = 'assets/_resampled/ResizedImage' . Convert::base64url_encode(array(10, 20)) . '/HTMLEditorFieldTest_example.jpg';
     $this->assertEquals($neededFilename, (string) $xml[0]['src'], 'Correct URL of resized image is set.');
     $this->assertTrue(file_exists(BASE_PATH . DIRECTORY_SEPARATOR . $neededFilename), 'File for resized image exists');
     $this->assertEquals(false, $obj->HasBrokenFile, 'Referenced image file exists.');
 }
开发者ID:hpeide,项目名称:silverstripe-framework,代码行数:31,代码来源:HtmlEditorFieldTest.php


示例2: testProcess

 function testProcess()
 {
     $form = $this->setupFormFrontend();
     $controller = new UserDefinedFormControllerTest_Controller($form);
     $this->autoFollowRedirection = false;
     $this->clearEmails();
     // load the form
     $this->get($form->URLSegment);
     $response = $this->submitForm('Form_Form', null, array('basic-text-name' => 'Basic Value'));
     // should have a submitted form field now
     $submitted = DataObject::get('SubmittedFormField', "\"Name\" = 'basic-text-name'");
     $this->assertDOSAllMatch(array('Name' => 'basic-text-name', 'Value' => 'Basic Value', 'Title' => 'Basic Text Field'), $submitted);
     // check emails
     $this->assertEmailSent('[email protected]', '[email protected]', 'Email Subject');
     $email = $this->findEmail('[email protected]', '[email protected]', 'Email Subject');
     // assert that the email has the field title and the value html email
     $parser = new CSSContentParser($email['content']);
     $title = $parser->getBySelector('strong');
     $this->assertEquals('Basic Text Field', (string) $title[0], 'Email contains the field name');
     $value = $parser->getBySelector('dd');
     $this->assertEquals('Basic Value', (string) $value[0], 'Email contains the value');
     // no html
     $this->assertEmailSent('[email protected]', '[email protected]', 'Email Subject');
     $nohtml = $this->findEmail('[email protected]', '[email protected]', 'Email Subject');
     $this->assertContains('Basic Text Field - Basic Value', $nohtml['content'], 'Email contains no html');
     // no data
     $this->assertEmailSent('[email protected]', '[email protected]', 'Email Subject');
     $nodata = $this->findEmail('[email protected]', '[email protected]', 'Email Subject');
     $parser = new CSSContentParser($nodata['content']);
     $list = $parser->getBySelector('dl');
     $this->assertFalse(isset($list[0]), 'Email contains no fields');
     // check to see if the user was redirected (301)
     $this->assertEquals($response->getStatusCode(), 302);
     $this->assertStringEndsWith('finished', $response->getHeader('Location'));
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:35,代码来源:UserDefinedFormControllerTest.php


示例3: testCorrectNumberOfRowsInTable

 function testCorrectNumberOfRowsInTable()
 {
     $field = $this->manyManyForm->dataFieldByName('Players');
     $parser = new CSSContentParser($field->FieldHolder());
     $this->assertEquals(count($parser->getBySelector('tbody tr')), 2, 'There are 2 players (rows) in the table');
     $this->assertEquals($field->Items()->Count(), 2, 'There are 2 CTF items in the DataObjectSet');
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:7,代码来源:ComplexTableFieldTest.php


示例4: testShowDeleteButtonsWithAdminPermission

 public function testShowDeleteButtonsWithAdminPermission()
 {
     $this->logInWithPermission('ADMIN');
     $content = new CSSContentParser($this->gridField->FieldHolder());
     $deleteButtons = $content->getBySelector('.gridfield-button-delete');
     $this->assertEquals(3, count($deleteButtons), 'Delete buttons should show when logged in.');
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:7,代码来源:GridFieldDeleteActionTest.php


示例5: testShowEditLinksWithAdminPermission

 public function testShowEditLinksWithAdminPermission()
 {
     $this->logInWithPermission('ADMIN');
     $content = new CSSContentParser($this->gridField->FieldHolder());
     $editLinks = $content->getBySelector('.edit-link');
     $this->assertEquals(2, count($editLinks), 'Edit links should show when logged in.');
 }
开发者ID:normann,项目名称:sapphire,代码行数:7,代码来源:GridFieldEditButtonTest.php


示例6: testSetDefaultItems

	function testSetDefaultItems() {
		$f = new CheckboxSetField(
			'Test', 
			false, 
			array(0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => 'Three')
		);
		
		$f->setValue(array(0,1));
		$f->setDefaultItems(array(2));
		$p = new CSSContentParser($f->Field());
		$item0 = $p->getBySelector('#Test_0');
		$item1 = $p->getBySelector('#Test_1');
		$item2 = $p->getBySelector('#Test_2');
		$item3 = $p->getBySelector('#Test_3');
		$this->assertEquals(
			(string)$item0[0]['checked'],
			'checked',
			'Selected through value'
		);
		$this->assertEquals(
			(string)$item1[0]['checked'],
			'checked',
			'Selected through value'
		);
		$this->assertEquals(
			(string)$item2[0]['checked'],
			'checked',
			'Selected through default items'
		);
		$this->assertEquals(
			(string)$item3[0]['checked'],
			'',
			'Not selected by either value or default items'
		);
	}
开发者ID:redema,项目名称:sapphire,代码行数:35,代码来源:CheckboxSetFieldTest.php


示例7: testAdd

	function testAdd() {
		$this->logInWithPermission('ADMIN');
		$team1 = $this->objFromFixture('GridFieldTest_Team', 'team1');
		$team2 = $this->objFromFixture('GridFieldTest_Team', 'team2');

		$response = $this->get('GridFieldAddExistingAutocompleterTest_Controller');
		$this->assertFalse($response->isError());
		$parser = new CSSContentParser($response->getBody());
		$items = $parser->getBySelector('.ss-gridfield .ss-gridfield-items .ss-gridfield-item');
		$this->assertEquals(1, count($items));
		$this->assertEquals($team1->ID, (int)$items[0]['data-id']);

		$btns = $parser->getBySelector('.ss-gridfield #action_gridfield_relationadd');
		$response = $this->post(
			'GridFieldAddExistingAutocompleterTest_Controller/Form/field/testfield',
			array(
				'relationID' => $team2->ID,
				(string)$btns[0]['name'] => 1
			)
		);
		$this->assertFalse($response->isError());
		$parser = new CSSContentParser($response->getBody());
		$items = $parser->getBySelector('.ss-gridfield .ss-gridfield-items .ss-gridfield-item');
		$this->assertEquals(2, count($items));
		$this->assertDOSEquals(array(
			array('ID' => (int)$items[0]['data-id']),
			array('ID' => (int)$items[1]['data-id']),
		), new ArrayList(array($team1, $team2)));
		
	}
开发者ID:redema,项目名称:sapphire,代码行数:30,代码来源:GridFieldAddExistingAutocompleterTest.php


示例8: testNestedEditForm

 function testNestedEditForm()
 {
     $this->logInWithPermission('ADMIN');
     $group = $this->objFromFixture('GridFieldDetailFormTest_PeopleGroup', 'group');
     $person = $group->People()->First();
     $category = $person->Categories()->First();
     // Get first form (GridField managing PeopleGroup)
     $response = $this->get('GridFieldDetailFormTest_GroupController');
     $this->assertFalse($response->isError());
     $parser = new CSSContentParser($response->getBody());
     $groupEditLink = $parser->getByXpath('//tr[contains(@class, "ss-gridfield-item") and contains(@data-id, "' . $group->ID . '")]//a');
     $this->assertEquals('GridFieldDetailFormTest_GroupController/Form/field/testfield/item/' . $group->ID . '/edit', (string) $groupEditLink[0]['href']);
     // Get second level form (GridField managing Person)
     $response = $this->get((string) $groupEditLink[0]['href']);
     $this->assertFalse($response->isError());
     $parser = new CSSContentParser($response->getBody());
     $personEditLink = $parser->getByXpath('//fieldset[@id="Form_ItemEditForm_People"]//tr[contains(@class, "ss-gridfield-item") and contains(@data-id, "' . $person->ID . '")]//a');
     $this->assertEquals(sprintf('GridFieldDetailFormTest_GroupController/Form/field/testfield/item/%d/ItemEditForm/field/People/item/%d/edit', $group->ID, $person->ID), (string) $personEditLink[0]['href']);
     // Get third level form (GridField managing Category)
     $response = $this->get((string) $personEditLink[0]['href']);
     $this->assertFalse($response->isError());
     $parser = new CSSContentParser($response->getBody());
     $categoryEditLink = $parser->getByXpath('//fieldset[@id="Form_ItemEditForm_Categories"]//tr[contains(@class, "ss-gridfield-item") and contains(@data-id, "' . $category->ID . '")]//a');
     $this->assertEquals(sprintf('GridFieldDetailFormTest_GroupController/Form/field/testfield/item/%d/ItemEditForm/field/People/item/%d/ItemEditForm/field/Categories/item/%d/edit', $group->ID, $person->ID, $category->ID), (string) $categoryEditLink[0]['href']);
     // Fourth level form would be a Category detail view
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:26,代码来源:GridFieldDetailFormTest.php


示例9: testSetDisabledItems

 public function testSetDisabledItems()
 {
     $f = new OptionsetField('Test', false, array(0 => 'Zero', 1 => 'One'));
     $f->setDisabledItems(array(0));
     $p = new CSSContentParser($f->Field());
     $item0 = $p->getBySelector('#Test_0');
     $item1 = $p->getBySelector('#Test_1');
     $this->assertEquals((string) $item0[0]['disabled'], 'disabled');
     $this->assertEquals((string) $item1[0]['disabled'], '');
 }
开发者ID:normann,项目名称:sapphire,代码行数:10,代码来源:OptionsetFieldTest.php


示例10: testDateFormatCustomFormatAppearsInCustomInputInField

	function testDateFormatCustomFormatAppearsInCustomInputInField() {
		$member = $this->objFromFixture('Member', 'noformatmember');
		$member->setField('DateFormat', 'dd MM yy');
		$field = $this->createDateFormatFieldForMember($member);
		$field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldList(), new FieldList())); // fake form
		$parser = new CSSContentParser($field->Field());
		$xmlInputArr = $parser->getBySelector('.valCustom input');
		$xmlPreview = $parser->getBySelector('.preview');
		$this->assertEquals('checked', (string) $xmlInputArr[0]['checked']);
		$this->assertEquals('dd MM yy', (string) $xmlInputArr[1]['value']);
	}
开发者ID:redema,项目名称:sapphire,代码行数:11,代码来源:MemberDatetimeOptionsetFieldTest.php


示例11: testLegend

 public function testLegend()
 {
     $composite = new CompositeField(new TextField('A'), new TextField('B'));
     $composite->setTag('fieldset');
     $composite->setLegend('My legend');
     $parser = new CSSContentParser($composite->Field());
     $root = $parser->getBySelector('fieldset.composite');
     $legend = $parser->getBySelector('fieldset.composite legend');
     $this->assertNotNull($legend);
     $this->assertEquals('My legend', (string) $legend[0]);
 }
开发者ID:XDdesigners,项目名称:silverstripe-framework,代码行数:11,代码来源:CompositeFieldTest.php


示例12: testThereIsNoPaginatorWhenOnlyOnePage

 function testThereIsNoPaginatorWhenOnlyOnePage()
 {
     // We set the itemsPerPage to an reasonably big number so as to avoid test broke from small changes on the fixture YML file
     $total = $this->list->count();
     $this->gridField->getConfig()->getComponentByType("GridFieldPaginator")->setItemsPerPage($total);
     $fieldHolder = $this->gridField->FieldHolder();
     $content = new CSSContentParser($fieldHolder);
     // Check that there is no paginator render into the footer
     $this->assertEquals(0, count($content->getBySelector('.datagrid-pagination')));
     // Check that there is still 'View 1 - 4 of 4' part on the left of the paginator
     $this->assertEquals(1, count($content->getBySelector('.pagination-records-number')));
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:12,代码来源:GridFieldPaginatorTest.php


示例13: testExportLink

 public function testExportLink()
 {
     $page = $this->objFromFixture('RegistryPageTestPage', 'contact-registrypage');
     $response = $this->get($page->RelativeLink('RegistryFilterForm') . '?' . http_build_query(array('FirstName' => 'Alexander', 'Sort' => 'FirstName', 'Dir' => 'DESC', 'action_doRegistryFilter' => 'Filter')));
     $parser = new CSSContentParser($response->getBody());
     $anchor = $parser->getBySelector('a.export');
     $this->assertContains('export?', (string) $anchor[0]['href']);
     $this->assertContains('FirstName=Alexander', (string) $anchor[0]['href']);
     $this->assertContains('Surname=', (string) $anchor[0]['href']);
     $this->assertContains('Sort=FirstName', (string) $anchor[0]['href']);
     $this->assertContains('Dir=DESC', (string) $anchor[0]['href']);
     $this->assertContains('action_doRegistryFilter=Filter', (string) $anchor[0]['href']);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-registry,代码行数:13,代码来源:RegistryPageFunctionalTest.php


示例14: testLegacyItemsFieldHolderWithTitle

 function testLegacyItemsFieldHolderWithTitle()
 {
     $items = array('one//one title' => new LiteralField('one', 'one view'), 'two//two title' => new LiteralField('two', 'two view'));
     $field = new SelectionGroup('MyGroup', $items);
     $parser = new CSSContentParser($field->FieldHolder());
     $listEls = $parser->getBySelector('li');
     $listElOne = $listEls[0];
     $listElTwo = $listEls[1];
     $this->assertEquals('one', (string) $listElOne->input[0]['value']);
     $this->assertEquals('two', (string) $listElTwo->input[0]['value']);
     $this->assertEquals('one title', (string) $listElOne->label[0]);
     $this->assertEquals('two title', (string) $listElTwo->label[0]);
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:13,代码来源:SelectionGroupTest.php


示例15: testShowDropdownCustomTimeFormat

 function testShowDropdownCustomTimeFormat()
 {
     $field = new TimeDropdownField('Time', 'Time');
     $field->setConfig('showdropdown', true);
     $field->setConfig('timeformat', 'hh:mm a');
     $html = $field->Field();
     $parser = new CSSContentParser($html);
     $this->assertNotNull($parser->getBySelector('select'));
     $options = $parser->getBySelector('option');
     $this->assertEquals('00:00:00', (string) $options[0]['value'], 'Correct data value');
     $this->assertEquals('13:00:00', (string) $options[13]['value'], 'Correct data value');
     $this->assertEquals('12:00 AM', (string) $options[0], 'Correct view value');
     $this->assertEquals('01:00 PM', (string) $options[13], 'Correct view value');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-timedropdownfield,代码行数:14,代码来源:TimeDropdownFieldTest.php


示例16: testEmailWriter

 function testEmailWriter()
 {
     $testEmailWriter = new SS_LogEmailWriter('[email protected]');
     SS_Log::add_writer($testEmailWriter, SS_Log::ERR);
     SS_Log::log('Email test', SS_LOG::ERR, array('my-string' => 'test', 'my-array' => array('one' => 1)));
     $this->assertEmailSent('[email protected]');
     $email = $this->findEmail('[email protected]');
     $parser = new CSSContentParser($email['htmlContent']);
     $extras = $parser->getBySelector('table.extras');
     $extraRows = $extras[0]->tr;
     $this->assertContains('my-string', $extraRows[count($extraRows) - 2]->td[0]->asXML(), 'Contains extra data key');
     $this->assertContains('test', $extraRows[count($extraRows) - 2]->td[1]->asXML(), 'Contains extra data value');
     $this->assertContains('my-array', $extraRows[count($extraRows) - 1]->td[0]->asXML(), 'Contains extra data key');
     $this->assertContains("array('one'=&gt;1,)", str_replace(array("\r", "\n", " "), '', $extraRows[count($extraRows) - 1]->td[1]->asXML()), 'Serializes arrays correctly');
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:15,代码来源:LogTest.php


示例17: testGetSubmissionns

 function testGetSubmissionns()
 {
     $template = $this->field->getSubmissions();
     $parser = new CSSContentParser($template);
     // check to ensure that the pagination exists
     $pagination = $parser->getBySelector('.userforms-submissions-pagination');
     $this->assertEquals(str_replace("\n", ' ', (string) $pagination[0]->span), "Viewing rows 0 - 10 of 11 rows");
     $this->assertEquals(str_replace("\n", ' ', (string) $pagination[0]->a), "Next page");
     // ensure the actions exist
     $actions = $parser->getBySelector('.userforms-submission-actions');
     $this->assertEquals(count($actions[0]->li), 2);
     // submissions
     $submissions = $parser->getBySelector('.userform-submission');
     $this->assertEquals(count($submissions), 10);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:15,代码来源:SubmittedFormTest.php


示例18: testGoballyEffected

 public function testGoballyEffected()
 {
     Session::clear('GridField.PaginatorWithShowAll.Mode');
     $this->gridField1->State->GridFieldShowAll->showAllMode = true;
     $this->gridField1->FieldHolder();
     $fieldHolder21 = $this->gridField2->FieldHolder();
     $content21 = new CSSContentParser($fieldHolder21);
     $this->assertEquals(6, count($content21->getBySelector('tr.ss-gridfield-item')));
     $this->gridField1->State->GridFieldShowAll->showAllMode = false;
     $this->gridField1->FieldHolder();
     $this->gridField2->getConfig()->getComponentByType('GridFieldPaginatorWithShowAll')->setItemsPerPage(2);
     $fieldHolder22 = $this->gridField2->FieldHolder();
     $content22 = new CSSContentParser($fieldHolder22);
     $this->assertEquals(2, count($content22->getBySelector('tr.ss-gridfield-item')));
     Session::clear('GridField.PaginatorWithShowAll.Mode');
 }
开发者ID:helpfulrobot,项目名称:normann-gridfieldpaginatorwithshowall,代码行数:16,代码来源:GridFieldPaginatorWithShowAllTest.php


示例19: testTreeSearch

 public function testTreeSearch()
 {
     $field = new TreeDropdownField('TestTree', 'Test tree', 'Folder');
     // case insensitive search against keyword 'sub' for folders
     $request = new SS_HTTPRequest('GET', 'url', array('search' => 'sub'));
     $tree = $field->tree($request);
     $folder1 = $this->objFromFixture('Folder', 'folder1');
     $folder1Subfolder1 = $this->objFromFixture('Folder', 'folder1-subfolder1');
     $parser = new CSSContentParser($tree);
     $cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item';
     $firstResult = $parser->getBySelector($cssPath);
     $this->assertEquals((string) $firstResult[0], $folder1Subfolder1->Name, $folder1Subfolder1->Name . ' is found, nested under ' . $folder1->Name);
     $subfolder = $this->objFromFixture('Folder', 'subfolder');
     $cssPath = 'ul.tree li#selector-TestTree-' . $subfolder->ID . ' a span.item';
     $secondResult = $parser->getBySelector($cssPath);
     $this->assertEquals((string) $secondResult[0], $subfolder->Name, $subfolder->Name . ' is found at root level');
     // other folders which don't contain the keyword 'sub' are not returned in search results
     $folder2 = $this->objFromFixture('Folder', 'folder2');
     $cssPath = 'ul.tree li#selector-TestTree-' . $folder2->ID . ' a span.item';
     $noResult = $parser->getBySelector($cssPath);
     $this->assertEquals($noResult, array(), $folder2 . ' is not found');
     $field = new TreeDropdownField('TestTree', 'Test tree', 'File');
     // case insensitive search against keyword 'sub' for files
     $request = new SS_HTTPRequest('GET', 'url', array('search' => 'sub'));
     $tree = $field->tree($request);
     $parser = new CSSContentParser($tree);
     // Even if we used File as the source object, folders are still returned because Folder is a File
     $cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item';
     $firstResult = $parser->getBySelector($cssPath);
     $this->assertEquals((string) $firstResult[0], $folder1Subfolder1->Name, $folder1Subfolder1->Name . ' is found, nested under ' . $folder1->Name);
     // Looking for two files with 'sub' in their name, both under the same folder
     $file1 = $this->objFromFixture('File', 'subfolderfile1');
     $file2 = $this->objFromFixture('File', 'subfolderfile2');
     $cssPath = 'ul.tree li#selector-TestTree-' . $subfolder->ID . ' li#selector-TestTree-' . $file1->ID . ' a';
     $firstResult = $parser->getBySelector($cssPath);
     $this->assertGreaterThan(0, count($firstResult), $file1->Name . ' with ID ' . $file1->ID . ' is in search results');
     $this->assertEquals((string) $firstResult[0], $file1->Name, $file1->Name . ' is found nested under ' . $subfolder->Name);
     $cssPath = 'ul.tree li#selector-TestTree-' . $subfolder->ID . ' li#selector-TestTree-' . $file2->ID . ' a';
     $secondResult = $parser->getBySelector($cssPath);
     $this->assertGreaterThan(0, count($secondResult), $file2->Name . ' with ID ' . $file2->ID . ' is in search results');
     $this->assertEquals((string) $secondResult[0], $file2->Name, $file2->Name . ' is found nested under ' . $subfolder->Name);
     // other files which don't include 'sub' are not returned in search results
     $file3 = $this->objFromFixture('File', 'asdf');
     $cssPath = 'ul.tree li#selector-TestTree-' . $file3->ID;
     $noResult = $parser->getBySelector($cssPath);
     $this->assertEquals($noResult, array(), $file3->Name . ' is not found');
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:47,代码来源:TreeDropdownFieldTest.php


示例20: testImageInsertion

 public function testImageInsertion()
 {
     $obj = new HtmlEditorFieldTest_Object();
     $editor = new HtmlEditorField('Content');
     $editor->setValue('<img src="assets/example.jpg" />');
     $editor->saveInto($obj);
     $parser = new CSSContentParser($obj->Content);
     $xml = $parser->getByXpath('//img');
     $this->assertEquals('', $xml[0]['alt'], 'Alt tags are added by default.');
     $this->assertEquals('', $xml[0]['title'], 'Title tags are added by default.');
     $editor->setValue('<img src="assets/example.jpg" alt="foo" title="bar" />');
     $editor->saveInto($obj);
     $parser = new CSSContentParser($obj->Content);
     $xml = $parser->getByXpath('//img');
     $this->assertEquals('foo', $xml[0]['alt'], 'Alt tags are preserved.');
     $this->assertEquals('bar', $xml[0]['title'], 'Title tags are preserved.');
 }
开发者ID:normann,项目名称:sapphire,代码行数:17,代码来源:HtmlEditorFieldTest.php



注:本文中的CSSContentParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CSSJanus类代码示例发布时间:2022-05-20
下一篇:
PHP CSS类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap