1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/12683] Add basic tests

PHPBB3-12683
This commit is contained in:
Ruben Calvo
2021-11-22 21:10:16 +01:00
parent d55f1e04eb
commit ac227a9ea6
9 changed files with 361 additions and 4 deletions

View File

@@ -0,0 +1,43 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\posting;
use phpbb\db\driver\driver_interface;
class post_helper
{
/**
* @var driver_interface
*/
protected $db;
public function __construct(driver_interface $db)
{
$this->db = $db;
}
/**
* Get last post id
*/
public function get_max_post_id(): int
{
$sql = 'SELECT MAX(post_id) as max_post_id
FROM '. POSTS_TABLE;
$result = $this->db->sql_query($sql);
$max_post_id = (int) $this->db->sql_fetchfield('max_post_id');
$this->db->sql_freeresult($result);
return $max_post_id;
}
}