Beispiel #1
0
 /**
  * @test
  */
 public function constructor()
 {
     $expressions = TestHelper::getPrivateProperty($this->where, 'expressions');
     $this->assertInstanceOf('\\Ackintosh\\Higher\\Query\\Expression\\ExpressionUnit', $expressions[0], '-> sets "ExpressionUnit" object.');
     $this->assertSame('AND', $expressions[1], '-> sets string.');
     $this->assertInstanceOf('\\Ackintosh\\Higher\\Query\\Expression\\ExpressionUnit', $expressions[2], '-> sets "ExpressionUnit" object.');
 }
Beispiel #2
0
 /**
  * @test
  */
 public function setValue()
 {
     $value = 'testvalue';
     $column = new Column($this->name, $this->type, $this->option);
     $column->setValue($value);
     $this->assertSame($value, TestHelper::getPrivateProperty($column, 'value'));
 }
Beispiel #3
0
 /**
  * @test
  */
 public function constructorSetsProperties()
 {
     $join = new Join($this->t1, $this->t2, $this->on);
     $this->assertSame($this->t1, TestHelper::getPrivateProperty($join, 'owner'));
     $this->assertSame($this->t2, TestHelper::getPrivateProperty($join, 'target'));
     $this->assertSame($this->on, TestHelper::getPrivateProperty($join, 'on'));
 }
Beispiel #4
0
 /**
  * @test
  */
 public function constructor()
 {
     $str = 'foo';
     $val = [1, 2, 3];
     $sql = new Sql($str, $val);
     $this->assertSame($str, TestHelper::getPrivateProperty($sql, 'sql'), '-> sets string to its "sql" property.');
     $this->assertSame($val, TestHelper::getPrivateProperty($sql, 'values'), '-> sets array to its "values" property.');
 }
Beispiel #5
0
 /**
  * @test
  */
 public function set()
 {
     $table = new Table();
     $update = new Update($table);
     $params = ['foo' => 123, 'bar' => 456];
     $update->set($params);
     $this->assertInstanceOf('\\Ackintosh\\Higher\\Query\\Set', TestHelper::getPrivateProperty($update, 'set'), '-> sets "Set" object to "set" property.');
 }
Beispiel #6
0
 /**
  * @test
  */
 public function OrHasOR()
 {
     $table = new Table();
     $params[0] = '';
     $params[1] = '';
     $params[2] = '';
     $expression = new Orx($table, $params);
     $this->assertSame('OR', TestHelper::getPrivateProperty($expression, 'pre'));
 }
Beispiel #7
0
 /**
  * @test
  */
 public function valuesSetsProperty()
 {
     $table = new Table();
     $columns = ['test1', 'test2'];
     $upsert = new Upsert($table, $columns);
     $values = ['value1', 'value2'];
     $upsert->values($values);
     $this->assertSame($values, TestHelper::getPrivateProperty($upsert, 'values'));
 }
Beispiel #8
0
 /**
  * @test
  */
 public function setColumns()
 {
     $table = new Table();
     $schema = ['id' => ['int', 'sequence'], 'name' => ['varchar'], 'created' => ['datetime']];
     $record = new Record($table);
     $record->setColumns($schema);
     $columns = TestHelper::getPrivateProperty($record, 'columns');
     $this->assertSame(count($schema), count($columns), '-> sets number of columns the same as the schema information.');
     $this->assertSame(array_keys($schema), $record->getColumnNames(), '-> sets the column that has been defined in schema information.');
 }
Beispiel #9
0
 /**
  * @test
  */
 public function joinPushesJoinObjecttoProperty()
 {
     $table = new Table();
     $columns = ['col1', 'col2'];
     $select = new Select($columns);
     $select->from($table);
     $table2 = new Table();
     $select->join($table2, ['on1' => 'on2']);
     $joins = TestHelper::getPrivateProperty($select, 'joins');
     $this->assertInstanceOf('Ackintosh\\Higher\\Query\\Join', array_pop($joins));
 }
Beispiel #10
0
 /**
  * @test
  */
 public function constructorSetsProperties()
 {
     $table = new Table();
     $params[0] = 'testcolumn';
     $params[1] = 'testexpr';
     $params[2] = 'testvlaue';
     $expression = new Andx($table, $params);
     $this->assertSame($table, TestHelper::getPrivateProperty($expression, 'table'));
     $this->assertSame($params[0], TestHelper::getPrivateProperty($expression, 'column'));
     $this->assertSame($params[1], TestHelper::getPrivateProperty($expression, 'expr'));
     $this->assertSame($params[2], TestHelper::getPrivateProperty($expression, 'value'));
 }
Beispiel #11
0
 /**
  * @test
  */
 public function _orAddsObjectToProperty()
 {
     $this->unit->_or(new Table(), [0, 0, 0]);
     $exprs = TestHelper::getPrivateProperty($this->unit, 'exprs');
     $this->assertInstanceOf('Ackintosh\\Higher\\Query\\Expression\\Orx', array_pop($exprs));
 }
Beispiel #12
0
 /**
  * @test
  */
 public function constructor()
 {
     $params = ['foo' => 123, 'bar' => 456];
     $set = new Set($params);
     $this->assertSame($params, TestHelper::getPrivateProperty($set, 'params'), '-> sets the params to "params" property.');
 }