Reputation: 9
I have a small .php
file with that one function which I've pasted below. I would like to test that function.
Is there any way of how I can use phpunit? I'm not using composer.json
.
<?php public function LoginMe($a, $b) //nick, psw
{
require 'includes/mysql_connection.php';
require 'includes/config.php';
require 'includes/messages.php';
require 'backend/LogsSystem.php';
// Some code
return false;
} ?>
Upvotes: 0
Views: 723
Reputation: 1722
For example, if your script is called authentication.php
, this can be a hint for test:
<?php
use PHPUnit\Framework\TestCase;
include 'authentication.php';
class authenticationTest extends TestCase
{
public function testAuthentication()
{
//your test here, call LoginMe with expected parameters
}
}
You may find interesting this too: PHP Testing, for Procedural Code
Upvotes: 2