Projet

Général

Profil

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

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

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
  public static function getInfo() {
14
    return array(
15
      'name' => 'PubSubHubbub',
16
      'description' => 'Tests for PubSubHubbub support.',
17
      'group' => 'Feeds',
18
    );
19
  }
20

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

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

    
30
    $challenge = '<script>alert();</script>';
31

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

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

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

    
47
}