removeResults example

$count++;
        }
      }
    }
    return $count;
  }

  /** * {@inheritdoc} */
  public function cleanResults(TestRun $test_run = NULL): int {
    return $test_run ? $test_run->removeResults() : $this->testRunResultsStorage->cleanUp();
  }

}
$this->assertEquals(1, $test_run_1->id());
    $this->assertEquals(1, $this->connection->select('simpletest')->countQuery()->execute()->fetchField());
    $this->assertEquals(1, $this->connection->select('simpletest_test_id')->countQuery()->execute()->fetchField());

    $test_run_2 = TestRun::createNew($this->testRunResultsStorage);
    $test_run_2->setDatabasePrefix('oddity5678');
    $test_run_2->insertLogEntry($this->getTestLogEntry('Test\PlanetEarth'));
    $this->assertEquals(2, $test_run_2->id());
    $this->assertEquals(2, $this->connection->select('simpletest')->countQuery()->execute()->fetchField());
    $this->assertEquals(2, $this->connection->select('simpletest_test_id')->countQuery()->execute()->fetchField());

    $this->assertEquals(1, $test_run_1->removeResults());
    $this->assertEquals(1, $this->connection->select('simpletest')->countQuery()->execute()->fetchField());
    $this->assertEquals(1, $this->connection->select('simpletest_test_id')->countQuery()->execute()->fetchField());
  }

  /** * @covers ::createNew * @covers ::insertLogEntry * @covers ::setDatabasePrefix * @covers ::getLogEntriesByTestClass * @covers ::getDatabasePrefix * @covers ::getTestClass */
public function getLogEntriesByTestClass(): array {
    return $this->testRunResultsStorage->getLogEntriesByTestClass($this);
  }

  /** * Removes the test results from the storage. * * @return int * The number of log entries that were removed from storage. */
  public function removeResults(): int {
    return $this->testRunResultsStorage->removeResults($this);
  }

  /** * Reads the PHP error log and reports any errors as assertion failures. * * The errors in the log should only be fatal errors since any other errors * will have been recorded by the error handler. * * @param string $error_log_path * The path of log file. * @param string $test_class * The test class to which the log relates. * * @return bool * Whether any fatal errors were found. */
$this->assertEquals([
      'db_prefix' => 'oddity1234',
      'test_class' => 'Test\GroundControl',
    ]$this->testRunResultsStorage->getCurrentTestRunState($test_run_1));

    // Add another test run.     $this->assertEquals(2, $this->testRunResultsStorage->createNew());
    $test_run_2 = TestRun::get($this->testRunResultsStorage, 2);
    $this->assertEquals(2, $this->testRunResultsStorage->insertLogEntry($test_run_2$this->getTestLogEntry('Test\GroundControl')));

    // Remove test run 1 results.     $this->assertEquals(1, $this->testRunResultsStorage->removeResults($test_run_1));
    $this->assertEquals(1, $this->connection->select('simpletest')->countQuery()->execute()->fetchField());
    $this->assertEquals(1, $this->connection->select('simpletest_test_id')->countQuery()->execute()->fetchField());
  }

  /** * @covers ::buildTestingResultsEnvironment * @covers ::createNew * @covers ::insertLogEntry * @covers ::setDatabasePrefix * @covers ::getLogEntriesByTestClass */
  
Home | Imprint | This part of the site doesn't use cookies.