@@ -49,12 +49,12 @@ class GistFilterTestCase extends DrupalWebTestCase {
4949 $langcode = LANGUAGE_NONE;
5050 $edit = array(
5151 "title" => $this->randomName(),
52- "body[$langcode][0][value]" => 'Hello! [gist:788436 ]',
52+ "body[$langcode][0][value]" => 'Hello! [gist:865412 ]',
5353 );
5454 $result = $this->drupalPost('node/add/' . $this->contentType->type, $edit, t('Save'));
5555 $this->assertResponse(200);
5656 $this->assertRaw("Hello! ");
57- $this->assertRaw('<script src="http://gist.github.com/788436 .js"></script>');
57+ $this->assertRaw('<script src="http://gist.github.com/865412 .js"></script>');
5858
5959 }
6060
@@ -99,11 +99,11 @@ class GistFilterTestCase extends DrupalWebTestCase {
9999 $langcode = LANGUAGE_NONE;
100100 $edit = array(
101101 "title" => $this->randomName(),
102- "body[$langcode][0][value]" => 'Hello! [gist:788436 ]',
102+ "body[$langcode][0][value]" => 'Hello! [gist:865412 ]',
103103 );
104104 $result = $this->drupalPost('node/add/' . $this->contentType->type, $edit, t('Save'));
105105 $this->assertResponse(200);
106- $this->assertRaw('Hello! <a href="http://gist.github.com/788436 ">http://gist.github.com/788436 </a>');
106+ $this->assertRaw('Hello! <a href="http://gist.github.com/865412 ">http://gist.github.com/865412 </a>');
107107
108108 }
109109
@@ -131,4 +131,44 @@ class GistFilterTestCase extends DrupalWebTestCase {
131131
132132 }
133133
134+ /**
135+ * Testing the code tag option.
136+ */
137+ function testCodeTagStyle() {
138+
139+ // Turn on our input filter and set the option to link.
140+ $edit = array(
141+ 'filters[gist_filter][status]' => 1,
142+ 'filters[gist_filter][settings][gist_filter_display_method]' => 'code',
143+ );
144+ $this->drupalPost('admin/config/content/formats/plain_text', $edit, t('Save configuration'));
145+
146+ // Create a test node
147+ $langcode = LANGUAGE_NONE;
148+ $edit = array(
149+ "title" => $this->randomName(),
150+ "body[$langcode][0][value]" => 'Hello! [gist:865412]',
151+ );
152+ $result = $this->drupalPost('node/add/' . $this->contentType->type, $edit, t('Save'));
153+ $this->assertResponse(200);
154+ $this->assertPattern("@<pre type=\"php\">(.*)echo(.*)</pre>@sm");
155+ $this->assertPattern("@<pre type=\"ruby\">(.*)a = 1\nputs a</pre>@");
156+
157+ }
158+
159+ /**
160+ * Test that our API retrieval function caches calls to the Github API.
161+ */
162+ function testGistCachingTest() {
163+ // Make sure our cache is all cleared first.
164+ cache_clear_all('gist_filter:gist', 'cache', TRUE);
165+ $this->assertFalse(cache_get('gist_filter:gist:865412'));
166+
167+ gist_filter_get_gist(865412);
168+
169+ // Now the cache should be set.
170+ $cached = cache_get('gist_filter:gist:865412');
171+ $this->assertTrue($cached->data);
172+ }
173+
134174}
0 commit comments