1
0
Fork 0
mirror of synced 2024-07-02 21:20:58 +12:00

Updated test values

This commit is contained in:
Eldad Fux 2020-08-09 18:03:52 +03:00
parent 49e24b726d
commit 5e5035bd2e
5 changed files with 37 additions and 37 deletions

View file

@ -566,15 +566,15 @@ trait AccountBase
/** /**
* Test for SUCCESS * Test for SUCCESS
*/ */
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
]), [ ]), [
'prefs' => [ 'prefs' => [
'key1' => 'value1', 'prefKey1' => 'prefValue1',
'key2' => 'value2', 'prefKey2' => 'prefValue2',
] ]
]); ]);
@ -582,13 +582,13 @@ trait AccountBase
$this->assertIsArray($response['body']); $this->assertIsArray($response['body']);
$this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']);
$this->assertEquals('value1', $response['body']['key1']); $this->assertEquals('prefValue1', $response['body']['prefKey1']);
$this->assertEquals('value2', $response['body']['key2']); $this->assertEquals('prefValue2', $response['body']['prefKey2']);
/** /**
* Test for FAILURE * Test for FAILURE
*/ */
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -596,7 +596,7 @@ trait AccountBase
$this->assertEquals($response['headers']['status-code'], 401); $this->assertEquals($response['headers']['status-code'], 401);
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -608,7 +608,7 @@ trait AccountBase
$this->assertEquals($response['headers']['status-code'], 400); $this->assertEquals($response['headers']['status-code'], 400);
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -619,7 +619,7 @@ trait AccountBase
$this->assertEquals($response['headers']['status-code'], 400); $this->assertEquals($response['headers']['status-code'], 400);
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],

View file

@ -24,9 +24,9 @@ class FunctionsConsoleClientTest extends Scope
], $this->getHeaders()), [ ], $this->getHeaders()), [
'name' => 'Test', 'name' => 'Test',
'vars' => [ 'vars' => [
'key1' => 'value1', 'funcKey1' => 'funcValue1',
'key2' => 'value2', 'funcKey2' => 'funcValue2',
'key3' => 'value3', 'funcKey3' => 'funcValue3',
], ],
'events' => [ 'events' => [
'account.create', 'account.create',

View file

@ -26,9 +26,9 @@ class FunctionsConsoleServerTest extends Scope
'name' => 'Test', 'name' => 'Test',
'env' => 'php-7.4', 'env' => 'php-7.4',
'vars' => [ 'vars' => [
'key1' => 'value1', 'funcKey1' => 'funcValue1',
'key2' => 'value2', 'funcKey2' => 'funcValue2',
'key3' => 'value3', 'funcKey3' => 'funcValue3',
], ],
'events' => [ 'events' => [
'account.create', 'account.create',
@ -48,9 +48,9 @@ class FunctionsConsoleServerTest extends Scope
$this->assertIsInt($response1['body']['dateUpdated']); $this->assertIsInt($response1['body']['dateUpdated']);
$this->assertEquals('', $response1['body']['tag']); $this->assertEquals('', $response1['body']['tag']);
$this->assertEquals([ $this->assertEquals([
'key1' => 'value1', 'funcKey1' => 'funcValue1',
'key2' => 'value2', 'funcKey2' => 'funcValue2',
'key3' => 'value3', 'funcKey3' => 'funcValue3',
], $response1['body']['vars']); ], $response1['body']['vars']);
$this->assertEquals([ $this->assertEquals([
'account.create', 'account.create',

View file

@ -132,24 +132,24 @@ trait UsersBase
/** /**
* Test for SUCCESS * Test for SUCCESS
*/ */
$user = $this->client->call(Client::METHOD_PUT, '/users/' . $data['userId'] . '/prefs', array_merge([ $user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'prefs' => [ 'prefs' => [
'key1' => 'value1', 'funcKey1' => 'funcValue1',
'key2' => 'value2', 'funcKey2' => 'funcValue2',
], ],
]); ]);
$this->assertEquals($user['headers']['status-code'], 200); $this->assertEquals($user['headers']['status-code'], 200);
$this->assertEquals($user['body']['key1'], 'value1'); $this->assertEquals($user['body']['funcKey1'], 'funcValue1');
$this->assertEquals($user['body']['key2'], 'value2'); $this->assertEquals($user['body']['funcKey2'], 'funcValue2');
/** /**
* Test for FAILURE * Test for FAILURE
*/ */
$user = $this->client->call(Client::METHOD_PUT, '/users/' . $data['userId'] . '/prefs', array_merge([ $user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
@ -158,7 +158,7 @@ trait UsersBase
$this->assertEquals($user['headers']['status-code'], 400); $this->assertEquals($user['headers']['status-code'], 400);
$user = $this->client->call(Client::METHOD_PUT, '/users/' . $data['userId'] . '/prefs', array_merge([ $user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders())); ], $this->getHeaders()));

View file

@ -35,32 +35,32 @@ class EventTest extends TestCase
public function testParams() public function testParams()
{ {
$this->object $this->object
->setParam('key1', 'value1') ->setParam('eventKey1', 'eventValue1')
->setParam('key2', 'value2') ->setParam('eventKey2', 'eventValue2')
; ;
$this->object->trigger(); $this->object->trigger();
$this->assertEquals(null, $this->object->getParam('key1')); $this->assertEquals(null, $this->object->getParam('eventKey1'));
$this->assertEquals(null, $this->object->getParam('key2')); $this->assertEquals(null, $this->object->getParam('eventKey2'));
$this->assertEquals(null, $this->object->getParam('key3')); $this->assertEquals(null, $this->object->getParam('eventKey3'));
$this->assertEquals(\Resque::size($this->queue), 1); $this->assertEquals(\Resque::size($this->queue), 1);
} }
public function testReset() public function testReset()
{ {
$this->object $this->object
->setParam('key1', 'value1') ->setParam('eventKey1', 'eventValue1')
->setParam('key2', 'value2') ->setParam('eventKey2', 'eventValue2')
; ;
$this->assertEquals('value1', $this->object->getParam('key1')); $this->assertEquals('eventValue1', $this->object->getParam('eventKey1'));
$this->assertEquals('value2', $this->object->getParam('key2')); $this->assertEquals('eventValue2', $this->object->getParam('eventKey2'));
$this->object->reset(); $this->object->reset();
$this->assertEquals(null, $this->object->getParam('key1')); $this->assertEquals(null, $this->object->getParam('eventKey1'));
$this->assertEquals(null, $this->object->getParam('key2')); $this->assertEquals(null, $this->object->getParam('eventKey2'));
$this->assertEquals(null, $this->object->getParam('key3')); $this->assertEquals(null, $this->object->getParam('eventKey3'));
} }
} }