. **/ require_once dirname(__FILE__).'/../../include/gettextwrapper.inc.php'; require_once dirname(__FILE__).'/../../include/defines.inc.php'; require_once dirname(__FILE__).'/../../include/db.inc.php'; use PHPUnit\Framework\TestCase; class zbx_dbcast_2bigintTest extends TestCase { /** * Possible test values. * * @return array */ public static function provider() { return [ ['field'], ['field_1'] ]; } /** * @dataProvider provider */ public function test_mysql($field) { global $DB; $oldDB = $DB; $DB['TYPE'] = ZBX_DB_MYSQL; $this->assertEquals('CAST('.$field.' AS UNSIGNED)', zbx_dbcast_2bigint($field)); $DB = $oldDB; } /** * @dataProvider provider */ public function test_oracle($field) { global $DB; $oldDB = $DB; $DB['TYPE'] = ZBX_DB_ORACLE; $this->assertEquals('CAST('.$field.' AS NUMBER(20))', zbx_dbcast_2bigint($field)); $DB = $oldDB; } /** * @dataProvider provider */ public function test_postgresql($field) { global $DB; $oldDB = $DB; $DB['TYPE'] = ZBX_DB_POSTGRESQL; $this->assertEquals('CAST('.$field.' AS BIGINT)', zbx_dbcast_2bigint($field)); $DB = $oldDB; } }