Projet

Général

Profil

Paste
Télécharger (1,12 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / feeds / tests / feeds_push.test @ ed9a13f1

1
<?php
2

    
3
/**
4
 * @file
5
 * Contains FeedsPushTest.
6
 */
7

    
8
/**
9
 * Tests for PubSubHubbub support in feeds.
10
 */
11
class FeedsPushTest extends FeedsWebTestCase {
12

    
13
  /**
14
   * {@inheritdoc}
15
   */
16
  public static function getInfo() {
17
    return array(
18
      'name' => 'PubSubHubbub',
19
      'description' => 'Tests for PubSubHubbub support.',
20
      'group' => 'Feeds',
21
    );
22
  }
23

    
24
  /**
25
   * Tests that PubSubHubbub challenge is escaped.
26
   */
27
  public function test() {
28
    $this->createImporterConfiguration('Push', 'push');
29

    
30
    $subscription = new PuSHSubscription('push', 0, 'http://example.com', 'http://example.com/feed', 'secret', 'unsubscribe', array());
31
    $subscription->save();
32

    
33
    $challenge = '<script>alert();</script>';
34

    
35
    $options = array(
36
      'query' => array(
37
        'hub.mode' => 'unsubscribe',
38
        'hub.challenge' => $challenge,
39
        'hub.topic' => 'http://example.com/feed',
40
      ),
41
    );
42

    
43
    $this->drupalGet("feeds/importer/push/0", $options);
44

    
45
    $this->assertResponse(200);
46
    $this->assertRaw(check_plain($challenge), 'Challenge was escaped.');
47
    $this->assertNoRaw($challenge, 'Raw challenge not found.');
48
  }
49

    
50
}