TYPO3 CMS  TYPO3_6-2
LogLevelTest.php
Go to the documentation of this file.
1 <?php
3 
23 
28  $validLevels = array(0, 1, 2, 3, 4, 5, 6, 7);
29  foreach ($validLevels as $validLevel) {
30  $this->assertTrue(\TYPO3\CMS\Core\Log\LogLevel::isValidLevel($validLevel));
31  }
32  }
33 
38  $invalidLevels = array(-1, 8, 1.5, 'string', array(), new \stdClass(), FALSE, NULL);
39  foreach ($invalidLevels as $invalidLevel) {
40  $this->assertFalse(\TYPO3\CMS\Core\Log\LogLevel::isValidLevel($invalidLevel));
41  }
42  }
43 
48  return array(
49  'negative integer' => array(-1),
50  'higher level than expected' => array(8),
51  'float' => array(1.5),
52  'string' => array('string'),
53  'array' => array(array()),
54  'object' => array(new \stdClass()),
55  'boolean FALSE' => array(FALSE),
56  'NULL' => array(NULL)
57  );
58  }
59 
67  }
68 
73  $this->assertEquals(7, \TYPO3\CMS\Core\Log\LogLevel::normalizeLevel('debug'));
74  }
75 
80  $levelString = 'invalid';
81  $this->assertEquals($levelString, \TYPO3\CMS\Core\Log\LogLevel::normalizeLevel($levelString));
82  }
83 }
static validateLevel($level)
Definition: LogLevel.php:134
isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSo($inputValue)