2019-09-16 08:17:10 +12:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\E2E;
|
|
|
|
|
|
|
|
use Tests\E2E\Client;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
2019-09-17 16:21:20 +12:00
|
|
|
class BaseConsole extends TestCase
|
2019-09-16 08:17:10 +12:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @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)
|
|
|
|
;
|
|
|
|
|
2019-09-30 19:13:40 +13:00
|
|
|
$this->demoEmail = 'user.' . rand(0, 1000000) . '@appwrite.io';
|
|
|
|
$this->demoPassword = 'password.' . rand(0, 1000000);
|
2019-09-16 08:17:10 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
$this->client = null;
|
|
|
|
}
|
|
|
|
|
2019-09-30 19:13:40 +13:00
|
|
|
public function register()
|
|
|
|
{
|
2019-09-16 08:17:10 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/auth/register', [
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
], [
|
|
|
|
'email' => $this->demoEmail,
|
|
|
|
'password' => $this->demoPassword,
|
2019-09-29 11:55:54 +13:00
|
|
|
'confirm' => 'http://localhost/confirm',
|
2019-09-16 08:17:10 +12:00
|
|
|
'success' => 'http://localhost/success',
|
|
|
|
'failure' => 'http://localhost/failure',
|
|
|
|
'name' => 'Demo User',
|
|
|
|
]);
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
2019-09-30 19:13:40 +13:00
|
|
|
}
|