diff --git a/invite.info b/invite.info
index 30e4649..c07026a 100644
--- a/invite.info
+++ b/invite.info
@@ -5,6 +5,7 @@ package = Invite
 
 files[] = includes/invite.controller.inc
 files[] = includes/invite.info.inc
+files[] = tests/InviteExpireTest.test
 
 ; Views includes
 files[] = views/invite.views_default.inc
@@ -13,3 +14,4 @@ configure = admin/config/people/invite
 
 dependencies[] = entity
 dependencies[] = ctools
+
diff --git a/tests/InviteExpireTest.test b/tests/InviteExpireTest.test
new file mode 100644
index 0000000..81388f9
--- /dev/null
+++ b/tests/InviteExpireTest.test
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * @file
+ * Contains \InviteExpireTest.
+ */
+
+class InviteExpireTest extends DrupalWebTestCase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    module_enable(array('invite'));
+  }
+
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'Invite expire',
+      'description' => 'Tests the invite expire time',
+      'group' => 'Invite',
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function testExpire() {
+
+    // Setup an expire time of 3 weeks.
+    // The idea of this test is to fake the expire time to - 3weeks to ensure
+    // that the checking works.
+    variable_set('invite_default_expiry_time', 21);
+
+    $invite_type = entity_create('invite_type', ['label' => 'Test invite type', 'type' => 'test_type']);
+    entity_save('invite_type', $invite_type);
+    drupal_static_reset('checkPermissions');
+
+    $inviter = $this->drupalCreateUser(array('create test_type entity'));
+    $invitee = $this->drupalCreateUser(array());
+
+    /** @var \Invite $invite */
+    $invite = entity_create('invite', ['type' => 'test_type']);
+    $invite->setUser($inviter);
+    $invite->invitee = $invitee->uid;
+
+    // Manipulate to set the expiry date to -3 weeks, and wait a second.
+    // If the expire checking works correctly,
+    $invite->expiry -= 3 * 7 * 24 * 3600;
+    entity_save('invite', $invite);
+    sleep(1);
+
+    $this->drupalLogin($invitee);
+    $this->drupalGet('invite/accept/' . $invite->reg_code);
+    $this->assertText('This invitation has expired.');
+    $this->assertUrl('<front>');
+
+    // Change back the expiry date to the future.
+    $invite->expiry += 3 * 7 * 24 * 3600;
+    entity_save('invite', $invite);
+
+    $this->drupalGet('invite/accept/' . $invite->reg_code);
+    $this->assertText(sprintf('You have accepted the invitation from %s.', $inviter->name));
+  }
+
+}
