comparison core/modules/taxonomy/tests/src/Functional/TokenReplaceTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
79 // Generate and test sanitized tokens for term1. 79 // Generate and test sanitized tokens for term1.
80 $tests = []; 80 $tests = [];
81 $tests['[term:tid]'] = $term1->id(); 81 $tests['[term:tid]'] = $term1->id();
82 $tests['[term:name]'] = $term1->getName(); 82 $tests['[term:name]'] = $term1->getName();
83 $tests['[term:description]'] = $term1->description->processed; 83 $tests['[term:description]'] = $term1->description->processed;
84 $tests['[term:url]'] = $term1->url('canonical', ['absolute' => TRUE]); 84 $tests['[term:url]'] = $term1->toUrl('canonical', ['absolute' => TRUE])->toString();
85 $tests['[term:node-count]'] = 0; 85 $tests['[term:node-count]'] = 0;
86 $tests['[term:parent:name]'] = '[term:parent:name]'; 86 $tests['[term:parent:name]'] = '[term:parent:name]';
87 $tests['[term:vocabulary:name]'] = $this->vocabulary->label(); 87 $tests['[term:vocabulary:name]'] = $this->vocabulary->label();
88 $tests['[term:vocabulary]'] = $this->vocabulary->label(); 88 $tests['[term:vocabulary]'] = $this->vocabulary->label();
89 89
110 // Generate and test sanitized tokens for term2. 110 // Generate and test sanitized tokens for term2.
111 $tests = []; 111 $tests = [];
112 $tests['[term:tid]'] = $term2->id(); 112 $tests['[term:tid]'] = $term2->id();
113 $tests['[term:name]'] = $term2->getName(); 113 $tests['[term:name]'] = $term2->getName();
114 $tests['[term:description]'] = $term2->description->processed; 114 $tests['[term:description]'] = $term2->description->processed;
115 $tests['[term:url]'] = $term2->url('canonical', ['absolute' => TRUE]); 115 $tests['[term:url]'] = $term2->toUrl('canonical', ['absolute' => TRUE])->toString();
116 $tests['[term:node-count]'] = 1; 116 $tests['[term:node-count]'] = 1;
117 $tests['[term:parent:name]'] = $term1->getName(); 117 $tests['[term:parent:name]'] = $term1->getName();
118 $tests['[term:parent:url]'] = $term1->url('canonical', ['absolute' => TRUE]); 118 $tests['[term:parent:url]'] = $term1->toUrl('canonical', ['absolute' => TRUE])->toString();
119 $tests['[term:parent:parent:name]'] = '[term:parent:parent:name]'; 119 $tests['[term:parent:parent:name]'] = '[term:parent:parent:name]';
120 $tests['[term:vocabulary:name]'] = $this->vocabulary->label(); 120 $tests['[term:vocabulary:name]'] = $this->vocabulary->label();
121 121
122 // Test to make sure that we generated something for each token. 122 // Test to make sure that we generated something for each token.
123 $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); 123 $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');