1 | <?php |
||
28 | abstract class AbstractIntegrationTest extends PHPUnit_Framework_TestCase |
||
29 | { |
||
30 | /** |
||
31 | * @var PDO |
||
32 | */ |
||
33 | protected $pdo; |
||
34 | |||
35 | protected function setUp() |
||
36 | { |
||
37 | $this->pdo = new PDO('crate:localhost:4200', null, null, []); |
||
38 | $query = 'CREATE TABLE test_table (id INTEGER PRIMARY KEY, name STRING,'; |
||
39 | $query .= 'int_type INTEGER, long_type LONG, boolean_type BOOLEAN,'; |
||
40 | $query .= 'double_type DOUBLE, float_type FLOAT, array_type ARRAY(INTEGER),'; |
||
41 | $query .= 'object_type OBJECT) CLUSTERED INTO 1 SHARDS WITH (number_of_replicas = 0)'; |
||
42 | $this->pdo->query($query); |
||
43 | } |
||
44 | |||
45 | protected function tearDown() |
||
49 | |||
50 | protected function insertRows($count = 1) |
||
51 | { |
||
52 | for ($i = 1; $i <= $count; $i++) { |
||
53 | $this->pdo->exec(sprintf("INSERT INTO test_table (id, name) VALUES (%d, 'hello world')", $i)); |
||
54 | } |
||
55 | |||
56 | $this->pdo->query('refresh table test_table'); |
||
57 | } |
||
58 | |||
59 | protected function insertRow($id, $name) |
||
64 | } |
||
65 |