Преглед на файлове

Merge pull request #301 from almasaeed2010/fix-example-test

Example Test Fix
Bradford Condon преди 7 години
родител
ревизия
9289b27d03
променени са 1 файла, в които са добавени 5 реда и са изтрити 27 реда
  1. 5 27
      tests/TripalJobsTest.test

+ 5 - 27
tests/TripalJobsTest.test

@@ -4,40 +4,18 @@ use PHPUnit\Framework\TestCase;
 
 class TripalJobsTest extends TestCase {
 
-  /**
-   * Holds the job id to delete when done.
-   *
-   * @var int|bool
-   */
-  protected $job_id;
-
   /**
    * Tests the ability to create a tripal job.
    *
    * @test
    */
   public function should_create_a_tripal_job() {
-    $this->job_id = tripal_add_job('Test adding jobs', 'test_module', 'test_callback', [], 1);
-    $this->assertTrue(is_numeric($this->job_id));
-  }
+    $job_id = tripal_add_job('Test adding jobs', 'tripal', 'tripal_tripal_cron_notification', [], 1);
+    $this->assertTrue(is_numeric($job_id));
 
-  /**
-   * Tests whether creating a duplicate job is possible.
-   *
-   * @test
-   */
-  public function should_refuse_to_create_duplicate_job() {
-    $job = tripal_add_job('Test adding jobs', 'test_module', 'test_callback', [], 1, 10, TRUE);
-    $this->assertEmpty($job);
-  }
-
-  /**
-   * Run clean up
-   */
-  public function __destruct() {
-    // Clean up any data inserted to the DB
-    if ($this->job_id) {
-      db_query('DELETE FROM {tripal_jobs} WHERE job_id = :id', [':id' => $this->job_id]);
+    // Clean up
+    if($job_id) {
+      db_query('DELETE FROM {tripal_jobs} WHERE job_id = :id', [':id' => $job_id]);
     }
   }
 }