summaryrefslogtreecommitdiff
path: root/scripts/dev/generate-phpt/src/setup/gtPreConditionList.php
blob: 06c17521f2ffeef9a4af73d4ed07f7b83344a876 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

/**
 * List of preconditions.
 *
 */
class gtPreConditionList {
  
  private $preConditions = array(
      'gtIsSpecifiedTestType',
      'gtIsSpecifiedFunctionOrMethod',  
      'gtIfClassHasMethod',
      'gtIsValidClass',
      'gtIsValidFunction',
      'gtIsValidMethod',
  );


  /**
   * Create an instance of each pre-condition and run their check methods
   *
   */
  public function check($clo) {
    foreach ($this->preConditions as $preCon) {
      $checkThis = new $preCon;
      if(!$checkThis->check($clo)) {
        echo $checkThis->getMessage();
        die(gtText::get('help'));
      }
    }
  }
}
?>