You are here

class DisqusAPITest in Drupal Most Popular 7

Hierarchy

Expanded class hierarchy of DisqusAPITest

File

modules/mostpopular_disqus/disqusapi/tests/disqusapi.php, line 10

View source
class DisqusAPITest extends PHPUnit_Framework_TestCase {
  private $secret = 'a';
  function test_setKey() {
    $api = new DisqusAPI('a');
    $this
      ->assertEquals($api->key, 'a');
    $api
      ->setKey('b');
    $this
      ->assertEquals($api->key, 'b');
  }
  function test_setFormat() {
    $api = new DisqusAPI();
    $this
      ->assertEquals($api->format, 'json');
    $api
      ->setFormat('jsonp');
    $this
      ->assertEquals($api->format, 'jsonp');
  }
  function test_setVersion() {
    $api = new DisqusAPI();
    $this
      ->assertEquals($api->version, '3.0');
    $api
      ->setVersion('3.1');
    $this
      ->assertEquals($api->version, '3.1');
  }

  /**
   * @expectedException DisqusInterfaceNotDefined
   */
  function test_invalid_function() {
    $api = new DisqusAPI();
    $api->users
      ->foo(array(
      'foo' => 'bar',
    ));
  }

  /**
   * @expectedException DisqusAPIError
   */
  function test_users_listActivity() {
    $api = new DisqusAPI($this->secret);
    $api->users
      ->listActivity(array(
      'foo' => 'bar',
    ));
  }

  /**
   * @expectedException Exception
   */
  function test_posts_create_missing_message() {
    $api = new DisqusAPI($this->secret);
    $api->posts
      ->create(array(
      'foo' => 'bar',
    ));
  }

  /**
   * @expectedException DisqusAPIError
   */
  function test_posts_create() {
    $api = new DisqusAPI($this->secret);
    $api->posts
      ->create(array(
      'message' => 'bar',
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DisqusAPITest::$secret private property
DisqusAPITest::test_invalid_function function @expectedException DisqusInterfaceNotDefined
DisqusAPITest::test_posts_create function @expectedException DisqusAPIError
DisqusAPITest::test_posts_create_missing_message function @expectedException Exception
DisqusAPITest::test_setFormat function
DisqusAPITest::test_setKey function
DisqusAPITest::test_setVersion function
DisqusAPITest::test_users_listActivity function @expectedException DisqusAPIError