|  | @@ -5,11 +5,14 @@
 | 
	
		
			
				|  |  |   * Basic simpletests to test options on link module.
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * Attribute Crud Test.
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  |  class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    private $zebra;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  public $permissions = array(
 | 
	
		
			
				|  |  | +  protected $permissions = array(
 | 
	
		
			
				|  |  |      'access content',
 | 
	
		
			
				|  |  |      'administer content types',
 | 
	
		
			
				|  |  |      'administer nodes',
 | 
	
	
		
			
				|  | @@ -20,6 +23,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |      'access administration pages',
 | 
	
		
			
				|  |  |    );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Get Info.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  |    public static function getInfo() {
 | 
	
		
			
				|  |  |      return array(
 | 
	
		
			
				|  |  |        'name' => 'Link Attribute Tests',
 | 
	
	
		
			
				|  | @@ -28,16 +34,24 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function setup() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Setup.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function setup() {
 | 
	
		
			
				|  |  | +    parent::setup('field_ui', 'link');
 | 
	
		
			
				|  |  |      $this->zebra = 0;
 | 
	
		
			
				|  |  | -    parent::setup('field_ui', 'link'); // was 'views'
 | 
	
		
			
				|  |  | -    //$this->loginWithPermissions($this->permissions);
 | 
	
		
			
				|  |  |      // Create and login user.
 | 
	
		
			
				|  |  | -    $account = $this->drupalCreateUser(array('administer content types'));
 | 
	
		
			
				|  |  | -    $this->drupalLogin($account);
 | 
	
		
			
				|  |  | +    $this->web_user = $this->drupalCreateUser(array(
 | 
	
		
			
				|  |  | +      'administer content types',
 | 
	
		
			
				|  |  | +      'administer fields',
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  | +    $this->drupalLogin($this->web_user);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function createLink($url, $title, $attributes = array()) {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Create Link.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  protected function createLink($url, $title, $attributes = array()) {
 | 
	
		
			
				|  |  |      return array(
 | 
	
		
			
				|  |  |        'url' => $url,
 | 
	
		
			
				|  |  |        'title' => $title,
 | 
	
	
		
			
				|  | @@ -45,23 +59,26 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  private function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Assert Link On Node.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  protected function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') {
 | 
	
		
			
				|  |  |      $this->zebra++;
 | 
	
		
			
				|  |  |      $zebra_string = ($this->zebra % 2 == 0) ? 'even' : 'odd';
 | 
	
		
			
				|  |  | -    $cssFieldLocator = 'field-'. str_replace('_', '-', $field_name);
 | 
	
		
			
				|  |  | -    $this->assertPattern('@<div class="field field-type-link '. $cssFieldLocator .'".*<div class="field-item '. $zebra_string .'">\s*'. $link_value .'\s*</div>@is',
 | 
	
		
			
				|  |  | -                         $message,
 | 
	
		
			
				|  |  | -                         $group);
 | 
	
		
			
				|  |  | +    $cssFieldLocator = 'field-' . str_replace('_', '-', $field_name);
 | 
	
		
			
				|  |  | +    $this->assertPattern('@<div class="field field-type-link ' . $cssFieldLocator . '".*<div class="field-item ' . $zebra_string . '">\s*' . $link_value . '\s*</div>@is',
 | 
	
		
			
				|  |  | +      $message,
 | 
	
		
			
				|  |  | +      $group);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    /**
 | 
	
		
			
				|  |  | -   * A simple test that just creates a new node type, adds a link field to it, creates a new node of that type, and makes sure
 | 
	
		
			
				|  |  | -   * that the node is being displayed.
 | 
	
		
			
				|  |  | +   * Test Basic.
 | 
	
		
			
				|  |  | +   *
 | 
	
		
			
				|  |  | +   * A simple test that just creates a new node type, adds a link field to it,
 | 
	
		
			
				|  |  | +   * creates a new node of that type, and makes sure that the node is being
 | 
	
		
			
				|  |  | +   * displayed.
 | 
	
		
			
				|  |  |     */
 | 
	
		
			
				|  |  | -  function testBasic() {
 | 
	
		
			
				|  |  | -    /*$this->acquireContentTypes(1);
 | 
	
		
			
				|  |  | -    variable_set('node_options_'. $this->content_types[0]->name, array('status', 'promote'));*/
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +  public function testBasic() {
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |      $title = $this->randomName(20);
 | 
	
	
		
			
				|  | @@ -71,7 +88,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |      // Create the content type.
 | 
	
		
			
				|  |  |      $this->clickLink(t('Add content type'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $edit = array (
 | 
	
		
			
				|  |  | +    $edit = array(
 | 
	
		
			
				|  |  |        'name' => $content_type_friendly,
 | 
	
		
			
				|  |  |        'type' => $content_type_machine,
 | 
	
		
			
				|  |  |      );
 | 
	
	
		
			
				|  | @@ -81,8 +98,8 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    $single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $edit = array (
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    $edit = array(
 | 
	
		
			
				|  |  |        'fields[_add_new_field][label]' => $single_field_name_friendly,
 | 
	
		
			
				|  |  |        'fields[_add_new_field][field_name]' => $single_field_name_machine,
 | 
	
		
			
				|  |  |        'fields[_add_new_field][type]' => 'link_field',
 | 
	
	
		
			
				|  | @@ -106,56 +123,35 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |      $this->assertTrue($type_exists, 'The new content type has been created in the database.');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $permission = 'create ' . $content_type_machine . ' content';
 | 
	
		
			
				|  |  | -    $permission_edit = 'edit ' . $content_type_machine . ' content';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      // Reset the permissions cache.
 | 
	
		
			
				|  |  |      $this->checkPermissions(array($permission), TRUE);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now that we have a new content type, create a user that has privileges
 | 
	
		
			
				|  |  |      // on the content type.
 | 
	
		
			
				|  |  |      $permissions = array_merge($this->permissions, array($permission));
 | 
	
		
			
				|  |  | -    $account = $this->drupalCreateUser($permissions);
 | 
	
		
			
				|  |  | -    $this->drupalLogin($account);
 | 
	
		
			
				|  |  | +    $this->web_user = $this->drupalCreateUser($permissions);
 | 
	
		
			
				|  |  | +    $this->drupalLogin($this->web_user);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Go to page.
 | 
	
		
			
				|  |  | -    $this->drupalGet('node/add/'. $content_type_machine);
 | 
	
		
			
				|  |  | +    $this->drupalGet('node/add/' . $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Add a node.
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  |        'title' => $title,
 | 
	
		
			
				|  |  | -      'field_'. $single_field_name_machine. '[und][0][title]' => 'Link',
 | 
	
		
			
				|  |  | -      'field_'. $single_field_name_machine. '[und][0][url]' => 'http://www.drupal.org/',
 | 
	
		
			
				|  |  | +      'field_' . $single_field_name_machine . '[und][0][title]' => 'Link',
 | 
	
		
			
				|  |  | +      'field_' . $single_field_name_machine . '[und][0][url]' => 'http://www.drupal.org/',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -    $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title)));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    /*$field_settings = array(
 | 
	
		
			
				|  |  | -      'type' => 'link',
 | 
	
		
			
				|  |  | -      'widget_type' => 'link',
 | 
	
		
			
				|  |  | -      'type_name' => $this->content_types[0]->name,
 | 
	
		
			
				|  |  | -      'attributes' => array(), // <-- This is needed or we have an error.
 | 
	
		
			
				|  |  | -    );
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $field = $this->createField($field_settings, 0);
 | 
	
		
			
				|  |  | -    //$this->pass('<pre>'. print_r($field, TRUE) .'</pre>');
 | 
	
		
			
				|  |  | -    $field_db_info = content_database_info($field);*/
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    //$this->acquireNodes(2);
 | 
	
		
			
				|  |  | -    /*$node = $this->drupalCreateNode(array('type' => $content_type_machine,
 | 
	
		
			
				|  |  | -                                          'promote' => 1));
 | 
	
		
			
				|  |  | -    $test_nid = $node->nid;*/
 | 
	
		
			
				|  |  | +    $this->assertText(t('@content_type_friendly @title has been created', array(
 | 
	
		
			
				|  |  | +      '@content_type_friendly' => $content_type_friendly,
 | 
	
		
			
				|  |  | +      '@title' => $title,
 | 
	
		
			
				|  |  | +    )));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    //$node = node_load($this->nodes[0]->nid);
 | 
	
		
			
				|  |  | -    //$node->promote = 1; // We want this to show on front page for the teaser test.
 | 
	
		
			
				|  |  | -    /*$this->assert('debug', print_r($node, TRUE), 'Debug');
 | 
	
		
			
				|  |  | -    $node->{$single_field_name}['und'][0] = $this->createLink('http://www.example.com', 'Test Link');
 | 
	
		
			
				|  |  | -    node_save($node);
 | 
	
		
			
				|  |  | -    $this->assert('debug', print_r($node, TRUE), 'Debug');*/
 | 
	
		
			
				|  |  | +    $this->drupalGet('node/add/' . $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    //$this->drupalGet('node/'. $test_nid .'/edit');
 | 
	
		
			
				|  |  | -    $this->drupalGet('node/add/'. $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // lets add a node:
 | 
	
		
			
				|  |  | +    // Create a node:
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  |        'title' => $title,
 | 
	
		
			
				|  |  |        'field_' . $single_field_name_machine . '[und][0][url]' => 'http://www.example.com/',
 | 
	
	
		
			
				|  | @@ -164,29 +160,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now we can fill in the second item in the multivalue field and save.
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -    $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title)));
 | 
	
		
			
				|  |  | +    $this->assertText(t('@content_type_friendly @title has been created', array(
 | 
	
		
			
				|  |  | +      '@content_type_friendly' => $content_type_friendly,
 | 
	
		
			
				|  |  | +      '@title' => $title,
 | 
	
		
			
				|  |  | +    )));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->assertText('Display');
 | 
	
		
			
				|  |  | -    //$this->assertText('http://www.example.com/');
 | 
	
		
			
				|  |  |      $this->assertLinkByHref('http://www.example.com');
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  private function createNodeType($content_type_machine, $content_type_friendly) {
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types');
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Create the content type.
 | 
	
		
			
				|  |  | -    $this->clickLink(t('Add content type'));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $edit = array (
 | 
	
		
			
				|  |  | -      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | -      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | -    );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save and add fields'));
 | 
	
		
			
				|  |  | -    $this->assertText(t('The content type @name has been added.', array('@name' => $content_type_friendly)));
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  private function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) {
 | 
	
		
			
				|  |  | -    $edit = array (
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Create Simple Link Field.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  protected function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) {
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/fields');
 | 
	
		
			
				|  |  | +    $edit = array(
 | 
	
		
			
				|  |  |        'fields[_add_new_field][label]' => $single_field_name_friendly,
 | 
	
		
			
				|  |  |        'fields[_add_new_field][field_name]' => $single_field_name_machine,
 | 
	
		
			
				|  |  |        'fields[_add_new_field][type]' => 'link_field',
 | 
	
	
		
			
				|  | @@ -209,22 +197,26 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |      $this->assertTrue($type_exists, 'The new content type has been created in the database.');
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function createNodeTypeUser($content_type_machine) {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Create Node Type User.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  protected function createNodeTypeUser($content_type_machine) {
 | 
	
		
			
				|  |  |      $permission = 'create ' . $content_type_machine . ' content';
 | 
	
		
			
				|  |  | -    $permission_edit = 'edit ' . $content_type_machine . ' content';
 | 
	
		
			
				|  |  |      // Reset the permissions cache.
 | 
	
		
			
				|  |  |      $this->checkPermissions(array($permission), TRUE);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now that we have a new content type, create a user that has privileges
 | 
	
		
			
				|  |  |      // on the content type.
 | 
	
		
			
				|  |  |      $permissions = array_merge($this->permissions, array($permission));
 | 
	
		
			
				|  |  | -    $account = $this->drupalCreateUser($permissions);
 | 
	
		
			
				|  |  | -    $this->drupalLogin($account);
 | 
	
		
			
				|  |  | +    $this->web_user = $this->drupalCreateUser($permissions);
 | 
	
		
			
				|  |  | +    $this->drupalLogin($this->web_user);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') {
 | 
	
		
			
				|  |  | -    // Go to page.
 | 
	
		
			
				|  |  | -    $this->drupalGet('node/add/'. $content_type_machine);
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Create Node For Testing.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  protected function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') {
 | 
	
		
			
				|  |  | +    $this->drupalGet('node/add/' . $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if (!$node_title) {
 | 
	
		
			
				|  |  |        $node_title = $this->randomName(20);
 | 
	
	
		
			
				|  | @@ -239,543 +231,359 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 | 
	
		
			
				|  |  |        $edit['field_' . $single_field_name_machine . '[und][0][title]'] = $title;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // Now we can fill in the second item in the multivalue field and save.
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -    $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $node_title)));
 | 
	
		
			
				|  |  | +    $this->assertText(t('@content_type_friendly @title has been created', array(
 | 
	
		
			
				|  |  | +      '@content_type_friendly' => $content_type_friendly,
 | 
	
		
			
				|  |  | +      '@title' => $node_title,
 | 
	
		
			
				|  |  | +    )));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function testFormatterPlain() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Test the link_plain formatter and it's output.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function testFormatterPlain() {
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | +    $this->drupalCreateContentType(array(
 | 
	
		
			
				|  |  | +      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | +      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | +    // $single_field_name = 'field_'. $single_field_name_machine;.
 | 
	
		
			
				|  |  |      $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][type]' => 'link_plain',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertText($link_url);
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertNoLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterPlainWithQuerystring() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
 | 
	
		
			
				|  |  | +    $link_tests = array(
 | 
	
		
			
				|  |  | +      'plain' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'query' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/?q=test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'fragment' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/#test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/?q=test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | +    foreach ($link_tests as $link_test) {
 | 
	
		
			
				|  |  | +      $link_text = $link_test['text'];
 | 
	
		
			
				|  |  | +      $link_url = $link_test['url'];
 | 
	
		
			
				|  |  | +      $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->assertText($link_url);
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertNoLinkByHref($link_url);
 | 
	
		
			
				|  |  | +      $this->assertText($link_url);
 | 
	
		
			
				|  |  | +      $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | +      $this->assertNoLinkByHref($link_url);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function testFormatterPlainWithFragment() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Formatter Host.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function testFormatterHost() {
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | +    $this->drupalCreateContentType(array(
 | 
	
		
			
				|  |  | +      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | +      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | +    // $single_field_name = 'field_'. $single_field_name_machine;.
 | 
	
		
			
				|  |  |      $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][type]' => 'link_host',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/#test';
 | 
	
		
			
				|  |  | +    $link_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  |      $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->assertText($link_url);
 | 
	
		
			
				|  |  | +    $this->assertText('www.example.com');
 | 
	
		
			
				|  |  |      $this->assertNoText($link_text);
 | 
	
		
			
				|  |  |      $this->assertNoLinkByHref($link_url);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function testFormatterURL() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Formatter URL.
 | 
	
		
			
				|  |  | +   *
 | 
	
		
			
				|  |  | +   * @codingStandardsIgnoreStart
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function testFormatterURL() {
 | 
	
		
			
				|  |  | +    // @codingStandardsIgnoreEnd
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | +    $this->drupalCreateContentType(array(
 | 
	
		
			
				|  |  | +      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | +      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | +    // $single_field_name = 'field_'. $single_field_name_machine;.
 | 
	
		
			
				|  |  |      $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][type]' => 'link_url',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterURLWithQuerystring() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
 | 
	
		
			
				|  |  | +    $link_tests = array(
 | 
	
		
			
				|  |  | +      'plain' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'query' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/?q=test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'fragment' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/#test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/?q=test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | +    foreach ($link_tests as $link_test) {
 | 
	
		
			
				|  |  | +      $link_text = $link_test['text'];
 | 
	
		
			
				|  |  | +      $link_url = $link_test['url'];
 | 
	
		
			
				|  |  | +      $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +      $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | +      $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function testFormatterURLWithAnchor() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Formatter Short.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function testFormatterShort() {
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | +    $this->drupalCreateContentType(array(
 | 
	
		
			
				|  |  | +      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | +      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | +    // $single_field_name = 'field_'. $single_field_name_machine;.
 | 
	
		
			
				|  |  |      $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][type]' => 'link_short',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/#test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterShort() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
 | 
	
		
			
				|  |  | +    $link_tests = array(
 | 
	
		
			
				|  |  | +      'plain' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'query' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/?q=test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'fragment' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/#test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | +    foreach ($link_tests as $link_test) {
 | 
	
		
			
				|  |  | +      $link_text = $link_test['text'];
 | 
	
		
			
				|  |  | +      $link_url = $link_test['url'];
 | 
	
		
			
				|  |  | +      $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->assertText('Link');
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +      $this->assertText('Link');
 | 
	
		
			
				|  |  | +      $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | +      $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function testFormatterShortWithQuerystring() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Formatter Label.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function testFormatterLabel() {
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | +    $this->drupalCreateContentType(array(
 | 
	
		
			
				|  |  | +      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | +      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | +    // $single_field_name = 'field_'. $single_field_name_machine;.
 | 
	
		
			
				|  |  |      $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][type]' => 'link_label',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/?q=test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertText('Link');
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterShortWithFragment() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
 | 
	
		
			
				|  |  | +    $link_tests = array(
 | 
	
		
			
				|  |  | +      'plain' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'query' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/?q=test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'fragment' => array(
 | 
	
		
			
				|  |  | +        'text' => 'Display',
 | 
	
		
			
				|  |  | +        'url' => 'http://www.example.com/#test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/#test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | +    foreach ($link_tests as $link_test) {
 | 
	
		
			
				|  |  | +      $link_text = $link_test['text'];
 | 
	
		
			
				|  |  | +      $link_url = $link_test['url'];
 | 
	
		
			
				|  |  | +      $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->assertText('Link');
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +      $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | +      $this->assertText($single_field_name_friendly);
 | 
	
		
			
				|  |  | +      $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function testFormatterLabel() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Formatter Separate.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function testFormatterSeparate() {
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | +    $this->drupalCreateContentType(array(
 | 
	
		
			
				|  |  | +      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | +      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | +    // $single_field_name = 'field_'. $single_field_name_machine;.
 | 
	
		
			
				|  |  |      $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][type]' => 'link_separate',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertText($single_field_name_friendly);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterLabelWithQuerystring() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
 | 
	
		
			
				|  |  | +    $plain_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  | +    $link_tests = array(
 | 
	
		
			
				|  |  | +      'plain' => array(
 | 
	
		
			
				|  |  | +        'text' => $this->randomName(20),
 | 
	
		
			
				|  |  | +        'url' => $plain_url,
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'query' => array(
 | 
	
		
			
				|  |  | +        'text' => $this->randomName(20),
 | 
	
		
			
				|  |  | +        'url' => $plain_url . '?q=test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      'fragment' => array(
 | 
	
		
			
				|  |  | +        'text' => $this->randomName(20),
 | 
	
		
			
				|  |  | +        'url' => $plain_url . '#test',
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  | +    foreach ($link_tests as $link_test) {
 | 
	
		
			
				|  |  | +      $link_text = $link_test['text'];
 | 
	
		
			
				|  |  | +      $link_url = $link_test['url'];
 | 
	
		
			
				|  |  | +      $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/?q=test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertText($single_field_name_friendly);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +      $this->assertText($link_text);
 | 
	
		
			
				|  |  | +      $this->assertLink($plain_url);
 | 
	
		
			
				|  |  | +      $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function testFormatterLabelWithFragment() {
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * Formatter Plain Title.
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  public function testFormatterPlainTitle() {
 | 
	
		
			
				|  |  |      $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | +    $this->drupalCreateContentType(array(
 | 
	
		
			
				|  |  | +      'type' => $content_type_machine,
 | 
	
		
			
				|  |  | +      'name' => $content_type_friendly,
 | 
	
		
			
				|  |  | +    ));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Now add a singleton field.
 | 
	
		
			
				|  |  |      $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  |      $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | +    // $single_field_name = 'field_'. $single_field_name_machine;.
 | 
	
		
			
				|  |  |      $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | +    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
 | 
	
		
			
				|  |  |      $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
 | 
	
		
			
				|  |  | +      'fields[field_' . $single_field_name_machine . '][type]' => 'link_title_plain',
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/#test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertNoText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertText($single_field_name_friendly);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterSeparate() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
 | 
	
		
			
				|  |  | -    );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $link_text = $this->randomName(20);
 | 
	
		
			
				|  |  |      $link_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  |      $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    $this->assertText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLink($link_url);
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterSeparateWithQuerystring() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
 | 
	
		
			
				|  |  | -    );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $link_text = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/?q=test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLink('http://www.example.com/');
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  function testFormatterSeparateWithFragment() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
 | 
	
		
			
				|  |  | -    );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $link_text = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/#test';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->assertText($link_text);
 | 
	
		
			
				|  |  | -    $this->assertLink('http://www.example.com/');
 | 
	
		
			
				|  |  | -    $this->assertLinkByHref($link_url);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -  
 | 
	
		
			
				|  |  | -  function testFormatterPlainTitle() {
 | 
	
		
			
				|  |  | -    $content_type_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $content_type_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    $this->createNodeType($content_type_machine, $content_type_friendly);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    // Now add a singleton field.
 | 
	
		
			
				|  |  | -    $single_field_name_friendly = $this->randomName(20);
 | 
	
		
			
				|  |  | -    $single_field_name_machine = strtolower($this->randomName(10));
 | 
	
		
			
				|  |  | -    //$single_field_name = 'field_'. $single_field_name_machine;
 | 
	
		
			
				|  |  | -    $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    // Okay, now we want to make sure this display is changed:
 | 
	
		
			
				|  |  | -    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
 | 
	
		
			
				|  |  | -    $edit = array(
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
 | 
	
		
			
				|  |  | -      'fields[field_'. $single_field_name_machine .'][type]' => 'link_title_plain',
 | 
	
		
			
				|  |  | -    );
 | 
	
		
			
				|  |  | -    $this->drupalPost(NULL, $edit, t('Save'));
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    $this->createNodeTypeUser($content_type_machine);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    $link_text = 'Display';
 | 
	
		
			
				|  |  | -    $link_url = 'http://www.example.com/';
 | 
	
		
			
				|  |  | -    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  |      $this->assertText($link_text);
 | 
	
		
			
				|  |  |      $this->assertNoText($link_url);
 | 
	
		
			
				|  |  |      $this->assertNoLinkByHref($link_url);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  /**
 | 
	
		
			
				|  |  | -   * This test sees that we can create a link field with a defined class, and make sure
 | 
	
		
			
				|  |  | -   * that class displays properly when the link is displayed.
 | 
	
		
			
				|  |  | -   */
 | 
	
		
			
				|  |  | -  /*function testLinkWithClassOnField() {
 | 
	
		
			
				|  |  | -    $this->acquireContentTypes(1);
 | 
	
		
			
				|  |  | -    $field_settings = array(
 | 
	
		
			
				|  |  | -      'type' => 'link',
 | 
	
		
			
				|  |  | -      'widget_type' => 'link',
 | 
	
		
			
				|  |  | -      'type_name' => $this->content_types[0]->name,
 | 
	
		
			
				|  |  | -      'attributes' => array(
 | 
	
		
			
				|  |  | -        'class' => 'test-class',
 | 
	
		
			
				|  |  | -        'target' => 'default',
 | 
	
		
			
				|  |  | -        'rel' => FALSE,
 | 
	
		
			
				|  |  | -      ),
 | 
	
		
			
				|  |  | -    );
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $field = $this->createField($field_settings, 0);
 | 
	
		
			
				|  |  | -    //$this->pass('<pre>'. print_r($field, TRUE) .'</pre>');
 | 
	
		
			
				|  |  | -    $field_db_info = content_database_info($field);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $this->acquireNodes(2);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    $node = node_load($this->nodes[0]->nid);
 | 
	
		
			
				|  |  | -    $node->promote = 1; // We want this to show on front page for the teaser test.
 | 
	
		
			
				|  |  | -    $node->{$field['field_name']}[0] = $this->createLink('http://www.example.com', 'Test Link');
 | 
	
		
			
				|  |  | -    node_save($node);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Does this display on the node page?
 | 
	
		
			
				|  |  | -    $this->drupalGet('node/'. $this->nodes[0]->nid);
 | 
	
		
			
				|  |  | -    //$this->outputScreenContents('Link field with class', 'link_');
 | 
	
		
			
				|  |  | -    $this->assertLinkOnNode($field['field_name'], l('Test Link', 'http://www.example.com', array('attributes' => array('class' => 'test-class'))));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // Does this display on the front page?
 | 
	
		
			
				|  |  | -    $this->drupalGet('<front>');
 | 
	
		
			
				|  |  | -    // reset the zebra!
 | 
	
		
			
				|  |  | -    $this->zebra = 0;
 | 
	
		
			
				|  |  | -    $this->assertLinkOnNode($field['field_name'], l('Test Link', 'http://www.example.com', array('attributes' => array('class' => 'test-class'))));
 | 
	
		
			
				|  |  | -  }*/
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  }
 |