1 system.test | public SystemValidTokenTest::testTokenValidation() |
Tests invalid invocations of backdrop_valid_token() that must return FALSE.
File
- core/
modules/ system/ tests/ system.test, line 2656 - Tests for system.module.
Class
- SystemValidTokenTest
- Test case for backdrop_valid_token().
Code
public function testTokenValidation() {
// The following checks will throw PHP notices, so we disable error
// assertions.
$this->assertErrors = FALSE;
$this->assertFalse(backdrop_valid_token(0, array()), 'Token 0, value array returns FALSE.');
$this->assertFalse(backdrop_valid_token('', array()), "Token '', value array returns FALSE.");
$this->assertFalse('' === backdrop_get_token(array()), 'Token generation does not return an empty string on invalid parameters.');
$this->assertErrors = TRUE;
$this->assertFalse(backdrop_valid_token(TRUE, 'foo'), 'Token TRUE, value foo returns FALSE.');
$this->assertFalse(backdrop_valid_token(0, 'foo'), 'Token 0, value foo returns FALSE.');
}