public function FacebookTrackingPixelTestTrackingCase::testFacebookTrackingPixelPathItemRouter in Facebook Tracking Pixel 7
Same name and namespace in other branches
- 8 tests/facebook_tracking_pixel.tracking.test \FacebookTrackingPixelTestTrackingCase::testFacebookTrackingPixelPathItemRouter()
Test path items using pages routed via menu router.
This will apply to views, custom modules, panels, etc.
File
- tests/
facebook_tracking_pixel.tracking.test, line 106
Class
- FacebookTrackingPixelTestTrackingCase
- Test case.
Code
public function testFacebookTrackingPixelPathItemRouter() {
// Test to add a path item to a menu router path item.
// We are going to use a path that is available in any Drupal installation.
$edit = [];
$edit['event_name'] = $this
->randomName(8);
$edit['event_path'] = 'admin';
$edit['event_base_code_id'] = $this->baseCodeID;
$edit['event_type[addtocart]'] = TRUE;
$edit['event_type[lead]'] = TRUE;
$this
->drupalPost('admin/config/system/facebook_tracking_pixel/path/add', $edit, t('Save'));
$this
->assertText(t('Path tracking entry added.'), t('Path tracking text confirmation on page displayed after form submit. Path name %name added', [
'%name' => $edit['event_name'],
]), 'FBTrkPx');
// Attempt to submit another item using the same menu router path.
$edit = [];
$edit['event_name'] = $this
->randomName(8);
$edit['event_path'] = 'admin';
$edit['event_base_code_id'] = $this->baseCodeID;
$edit['event_type[search]'] = TRUE;
$edit['event_type[registration]'] = TRUE;
$this
->drupalPost('admin/config/system/facebook_tracking_pixel/path/add', $edit, t('Save'));
$this
->assertText(t('You cannot add a duplicate event to the same path and base code.'), t('A duplicate menu router item was not allowed to be submitted'), 'FBTrkPx');
}