QueryTestCase::setUpBeforeClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
/**
3
 * Created by IntelliJ IDEA.
4
 * User: lfronius
5
 * Date: 09/10/14
6
 * Time: 16:59
7
 * To change this template use File | Settings | File Templates.
8
 */
9
10
namespace evseevnn\Cassandra\Tests\Setup;
11
12
use evseevnn\Cassandra;
13
14
abstract class QueryTestCase extends \PHPUnit_Framework_TestCase
15
{
16
17
		protected static $connection;
18
19
		public static function setUpBeforeClass()
20
		{
21
				self::$connection = new Cassandra\Database(['127.0.0.1:9042']);
22
				self::$connection->connect();
23
				self::$connection->query("DROP KEYSPACE IF EXISTS testkeyspace;");
24
				self::$connection->query(
25
						"CREATE KEYSPACE testkeyspace WITH replication = {   'class': 'SimpleStrategy',   'replication_factor': '1' };"
26
				);
27
				self::$connection->query("USE testkeyspace;");
28
		}
29
30
		public static function tearDownAfterClass()
31
		{
32
				self::$connection->query("DROP KEYSPACE testkeyspace;");
33
		}
34
35
	    public static function assertFloatEquals($expected, $actual)
36
	    {
37
		        self::assertEquals($expected, $actual, '', 0.00001);
38
	    }
39
40
}