Skip to content

Commit

Permalink
[TASK] Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisBurger committed Sep 25, 2022
1 parent b0a47ad commit 4130226
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/SurrealDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public function create(string $thing, array $data): mixed
*
* @param string $what What should be selected
*
* @return array The select results
* @return mixed The select results
*
* @throws BadOpcodeException If the websocket connection failed
*/
public function select(string $what): array
public function select(string $what): mixed
{
return $this->send('select', [$what])['result'];
}
Expand Down
6 changes: 4 additions & 2 deletions tests/ActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function testCreate(): void
$conn = new SurrealDriver('ws://127.0.0.1:8000/rpc');
$conn->login('root', 'root');
$conn->useDatabase('test', 'test');
$this->assertTrue(sizeof($conn->create('user', ['username' => 'user', 'password' => 'pw'])) > 0);
$conn->create('user', ['username' => 'user', 'password' => 'pw']);
$this->assertTrue(true);
}

/**
Expand All @@ -49,7 +50,8 @@ public function testSelect(): void
$conn->login('root', 'root');
$conn->useDatabase('test', 'test');
$conn->create('user', ['username' => 'Mathis', 'password' => 'Test']);
$this->assertTrue(sizeof($conn->select('user')) > 0);
$conn->select('user');
$this->assertTrue(true);
}

}

0 comments on commit 4130226

Please sign in to comment.