Skip to content

Commit

Permalink
test: use four spaces indentation instead of tabs
Browse files Browse the repository at this point in the history
There was no consistency in using spaces and tabs across test files. Now
all tests are indented using four spaces.

Aside of this, fixed places, where double indentation was used.

It was annoying to switch a text editor between different indentation
modes.
  • Loading branch information
Totktonada committed Mar 28, 2020
1 parent 261efae commit 9e1ebc5
Show file tree
Hide file tree
Showing 5 changed files with 722 additions and 722 deletions.
106 changes: 53 additions & 53 deletions test/AssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,57 @@

class AssertTest extends TestCase
{
use TestCaseCompat;

protected static $tarantool, $tm;

public static function doSetUpBeforeClass() {
self::$tm = ini_get("tarantool.request_timeout");
ini_set("tarantool.request_timeout", "0.1");
self::$tarantool = new Tarantool('localhost', getenv('PRIMARY_PORT'));
self::$tarantool->authenticate('test', 'test');
}

public static function doTearDownAfterClass() {
ini_set("tarantool.request_timeout", self::$tm);
}

protected function doTearDown() {
$tuples = self::$tarantool->select("test");
foreach($tuples as $value)
self::$tarantool->delete("test", Array($value[0]));
}

public function test_00_timedout() {
self::$tarantool->eval("
function assert_f()
os.execute('sleep 1')
return 0
end");
try {
$result = self::$tarantool->call("assert_f");
$this->assertFalse(True);
} catch (TarantoolException $e) {
// print($e->getMessage());
$this->assertStringContainsString(
"Failed to read", $e->getMessage());
}

/* We can reconnect and everything will be ok */
self::$tarantool->close();
self::$tarantool->select("test");
}

/**
* @doesNotPerformAssertions
*/
public function test_01_closed_connection() {
for ($i = 0; $i < 20000; $i++) {
try {
self::$tarantool->call("nonexistentfunction");
} catch (TarantoolClientError $e) {
continue;
}
}
}
use TestCaseCompat;

protected static $tarantool, $tm;

public static function doSetUpBeforeClass() {
self::$tm = ini_get("tarantool.request_timeout");
ini_set("tarantool.request_timeout", "0.1");
self::$tarantool = new Tarantool('localhost', getenv('PRIMARY_PORT'));
self::$tarantool->authenticate('test', 'test');
}

public static function doTearDownAfterClass() {
ini_set("tarantool.request_timeout", self::$tm);
}

protected function doTearDown() {
$tuples = self::$tarantool->select("test");
foreach($tuples as $value)
self::$tarantool->delete("test", Array($value[0]));
}

public function test_00_timedout() {
self::$tarantool->eval("
function assert_f()
os.execute('sleep 1')
return 0
end");
try {
$result = self::$tarantool->call("assert_f");
$this->assertFalse(True);
} catch (TarantoolException $e) {
// print($e->getMessage());
$this->assertStringContainsString(
"Failed to read", $e->getMessage());
}

/* We can reconnect and everything will be ok */
self::$tarantool->close();
self::$tarantool->select("test");
}

/**
* @doesNotPerformAssertions
*/
public function test_01_closed_connection() {
for ($i = 0; $i < 20000; $i++) {
try {
self::$tarantool->call("nonexistentfunction");
} catch (TarantoolClientError $e) {
continue;
}
}
}
}
Loading

0 comments on commit 9e1ebc5

Please sign in to comment.