I've setup a local env to do my dev and tests.
For some reason I cannot make phpunit work.
Here is what I have done.
Cloned the phpbb 3.3 github repo from here.
I've also did what is mentioned in 3.3.x/tests/RUNNING_TESTS.md
I have a
config_test.php
file located in my ./tests
directory.For some reason I think
phpunit
does not "see" that file. Here is the output of phpunit when I run it on an "empty" test with db.Code: Select all
-> % ./phpBB/vendor/bin/phpunit -c phpBB/ext/andreask/ium/phpunit.xml.dist --verbose
PHPUnit 9.5.20 #StandWithUkraine
Runtime: PHP 8.1.6
Configuration: phpBB/ext/andreask/ium/phpunit.xml.dist
Warning: Your XML configuration validates against a deprecated schema.
Suggestion: Migrate your XML configuration using "--migrate-configuration"!
E 1 / 1 (100%)
Time: 00:00.009, Memory: 8.00 MB
There was 1 error:
1) Warning
TypeError: phpbb\db\doctrine\connection_factory::get_connection_from_params(): Argument #1 ($driver) must be of type string, null given, called in /var/www/html/phpbb/phpBB/phpbb/db/doctrine/connection_factory.php on line 49 and defined in /var/www/html/phpbb/phpBB/phpbb/db/doctrine/connection_factory.php:73
Stack trace:
#0 /var/www/html/phpbb/phpBB/phpbb/db/doctrine/connection_factory.php(49): phpbb\db\doctrine\connection_factory::get_connection_from_params()
#1 /var/www/html/phpbb/tests/test_framework/phpbb_database_test_case.php(101): phpbb\db\doctrine\connection_factory::get_connection()
#2 /var/www/html/phpbb/phpBB/vendor/phpunit/phpunit/src/Framework/TestSuite.php(621): phpbb_database_test_case::setUpBeforeClass()
#3 /var/www/html/phpbb/phpBB/vendor/phpunit/phpunit/src/Framework/TestSuite.php(677): PHPUnit\Framework\TestSuite->run()
#4 /var/www/html/phpbb/phpBB/vendor/phpunit/phpunit/src/Framework/TestSuite.php(677): PHPUnit\Framework\TestSuite->run()
#5 /var/www/html/phpbb/phpBB/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(673): PHPUnit\Framework\TestSuite->run()
#6 /var/www/html/phpbb/phpBB/vendor/phpunit/phpunit/src/TextUI/Command.php(143): PHPUnit\TextUI\TestRunner->run()
#7 /var/www/html/phpbb/phpBB/vendor/phpunit/phpunit/src/TextUI/Command.php(96): PHPUnit\TextUI\Command->run()
#8 /var/www/html/phpbb/phpBB/vendor/phpunit/phpunit/phpunit(98): PHPUnit\TextUI\Command::main()
#9 /var/www/html/phpbb/phpBB/vendor/bin/phpunit(120): include('...')
#10 {main}
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
test_config.php
Code: Select all
<?php
// This file should be located as: tests/test_config.php
// So it will be placed after the RUNNING_TESTS.md file.
$dbms = 'phpbb\\db\\driver\\mysqli'; # Change this when needed
$dbhost = 'localhost';
$dbport = '';
$dbname = 'phpbb_tests'; # Change this
$dbuser = 'user'; # Change this
$dbpasswd = 'password'; # Change this
$table_prefix = 'phpbb_';
$phpbb_adm_relative_path = 'adm/';
$acm_type = 'phpbb\\cache\\driver\\file';
$phpbb_functional_url = 'http://test.devian/'; # Change this when needed
Code: Select all
<?php
namespace andreask\ium\tests\users;
class get_users_test extends \phpbb_database_test_case
{
protected $config;
protected $db;
protected $user;
protected $user_load;
protected $log;
protected $top_topic;
protected $ignore_us;
protected $request;
protected $rout_help;
public function setUp(): void
{
// parent::setUp();
// $this->config = $this->getMockBuilder('\phpbb\config\config')->disableOriginalConstructor()->getMock();
// $this->db = $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')
// ->disableOriginalConstructor()
// ->disableOriginalClone()
// ->disableArgumentCloning()
// ->disallowMockingUnknownTypes()
// ->getMock();
// $this->getMockBuilder('\phpbb\db\driver\mysqli')->disableOriginalConstructor()->getMock();
// $this->user = $this->getMockBuilder('\phpbb\user')->disableOriginalConstructor()->getMock();
// $this->user_load= $this->getMockBuilder('\phpbb\user_loader')->disableOriginalConstructor()->getMock();
// $this->log = $this->getMockBuilder('\phpbb\log\log')->disableOriginalConstructor()->getMock();
// $this->top_topic= $this->getMockBuilder('\andreak\ium\classes\top_topics')->disableOriginalConstructor()->getMock();
// $this->ignore_us= $this->getMockBuilder('\andreask\ium\classes\ignore_user')->disableOriginalConstructor()->getMock();
// $this->request = $this->getMockBuilder('\phpbb\request\request')->disableOriginalConstructor()->getMock();
// $this->rout_help= $this->getMockBuilder('\phpbb\routing\helper')->disableOriginalConstructor()->getMock();
// $this->reminder = new \andreask\ium\classes\reminder(
// $this->config,
// $this->db,
// $this->user,
// $this->user_load,
// $this->log,
// $this->top_topic,
// $this->ignore_us,
// $this->request,
// $this->rout_help,
// $this->table_prefix,
// $this->phpbb_root_path,
// $this->php_ext);
}
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/phpbb_users.xml');
}
}
What have I done wrong?
FYI
Code: Select all
php -v
PHP 8.1.6 (cli) (built: May 17 2022 16:48:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
with Zend OPcache v8.1.6, Copyright (c), by Zend Technologies