Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
test_invalid_link_tree.inc
1 <?php
28 {
29 
30 
37  public static function getName()
38  {
39  return 'Invalid Links on Link Tree Test';
40 
41  }//end getName()
42 
43 
50  public static function getDescription()
51  {
52  return 'A test to check for invalid links on the link tree in Matrix';
53 
54  }//end getDescription()
55 
56 
66  public static function test(&$messages, &$errors)
67  {
68  $status = TRUE;
69  $sql = 'SELECT linkid FROM sq_ast_lnk_tree WHERE linkid NOT IN (SELECT linkid FROM sq_ast_lnk WHERE link_type <= 4)';
70  $results = MatrixDAL::executeSqlAssoc($sql);
71  if (!empty($results)) {
72  $status = FALSE;
73 
74  foreach ($results as $index => $result) {
75  $results[$index] = $result['linkid'];
76  }
77  $results = array_unique($results);
78 
79  $messages[] = 'There are '.count($results).' invalid link(s) in the link tree on the system';
80  foreach ($results as $entry) {
81  $errors[] = 'Link #'.$entry.' on the link tree does not exist on the system';
82  }//end foreach
83  }//end if
84 
85  return $status;
86 
87  }//end test()
88 
89 }//end class
90 ?>