1
0
Fork 0
mirror of synced 2024-06-29 19:50:26 +12:00
appwrite/tests/e2e/BaseConsole.php
2019-09-30 11:43:40 +05:30

52 lines
1.2 KiB
PHP

<?php
namespace Tests\E2E;
use Tests\E2E\Client;
use PHPUnit\Framework\TestCase;
class BaseConsole extends TestCase
{
/**
* @var Client
*/
protected $client = null;
protected $endpoint = 'http://localhost/v1';
protected $demoEmail = '';
protected $demoPassword = '';
public function setUp()
{
$this->client = new Client();
$this->client
->setEndpoint($this->endpoint)
;
$this->demoEmail = 'user.' . rand(0, 1000000) . '@appwrite.io';
$this->demoPassword = 'password.' . rand(0, 1000000);
}
public function tearDown()
{
$this->client = null;
}
public function register()
{
$response = $this->client->call(Client::METHOD_POST, '/auth/register', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], [
'email' => $this->demoEmail,
'password' => $this->demoPassword,
'confirm' => 'http://localhost/confirm',
'success' => 'http://localhost/success',
'failure' => 'http://localhost/failure',
'name' => 'Demo User',
]);
return $response;
}
}