Outils pour utilisateurs

Outils du site


coach_energie:userstest.php
<?php
 
use App\Models\User ;
 
class UsersTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testNbrUsers()
    {
        $n = User::count();
        echo 'Nb users= ', $n, "\n";
    }
 
	public function testinsert ()
	{
		$users = User::create(
			[
				'email' => 'mail@test10',
				'lastname' => 'test10',
				'firstname' => 'test10',
				'password' => 'pass'
			]);	
	}
 
	/**
	 * @depends testinsert
	 */
	public function testselct()
	{
		$usersok = User::where('email', 'mail@test10')->count();
		echo $usersok."\n";
	}
 
	public function testinscription ()
	{
		$email = 'mail@test1000';
		$lastname = 'test10';
		$firstname = 'test10';
		$password = 'pass';
		$test = User::inscription($email, $lastname, $firstname, $password);
		if ($test == true)
			echo "inscription OK\n";
		else
			echo "erreur inscription\n";
	}
 
	public function testconect ()
	{
		$usersco = User::where('email', 'mail@test22')
			//test ok
			->where('password','pass')
			//test no ok
			//->where('password','passs')
			-> count();
		echo $usersco ."\n";
		if ($usersco == 0)
			echo "erreur co\n";
		else
			echo "co ok\n";
	}
}
coach_energie/userstest.php.txt · Dernière modification : 21/08/2020 13:26 de 127.0.0.1