-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathRandomTest.php
More file actions
51 lines (43 loc) · 1.37 KB
/
RandomTest.php
File metadata and controls
51 lines (43 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
use PHPUnit\Framework\TestCase;
final class RandomTest extends TestCase
{
protected static $tarantool;
public static function setUpBeforeClass() {
self::$tarantool = new Tarantool('localhost', getenv('PRIMARY_PORT'), 'test', 'test');
self::$tarantool->ping();
}
public function test_01_random_big_response() {
for ($i = 5000; $i < 100000; $i += 1000) {
$request = "do return '" . generateRandomString($i) . "' end";
self::$tarantool->evaluate($request);
}
$this->assertTrue(True);
}
public function test_02_very_big_response() {
$request = "do return '" . str_repeat('x', 1024 * 1024 * 1) . "' end";
self::$tarantool->evaluate($request);
$this->assertTrue(True);
}
public function test_03_another_big_response() {
for ($i = 100; $i <= 5200; $i += 100) {
$result = self::$tarantool->call('test_5', array($i));
$this->assertEquals($i, count($result));
}
}
/**
* @doesNotPerformAssertions
*/
public function test_04_get_strange_response() {
self::$tarantool->select("_schema", "12345");
}
}