PHP Classes

File: tests/QueryBuilderTest.php

Recommend this page to a friend!
  Classes of Samuel Adeshina   Query Builder   tests/QueryBuilderTest.php   Download  
File: tests/QueryBuilderTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Query Builder
Build SQL queries using a fluent interface
Author: By
Last change: FIxed Test issues
Date: 8 years ago
Size: 1,144 bytes
 

Contents

Class file image Download
<?php
/**
* QueryBuilderTest
* This file is part of the Plug-Query-Builder class
* @see QueryBuilder::__construct() for a detailed explanation of the method
* the tests below are conducted on
*
* @author Samuel Adeshina <samueladeshina73@gmal.com> <http://samshal.github.io>
* @version 0.0.1
* @since version 0.0.1, 4th January 2016
* @copyright 2016 - Samuel Adeshina <samueladeshina73@gmail.com>
* @license MIT
*/
namespace Plug\DBAL\QueryBuilder;

require
"../vendor/BuildableInterface.php";
require
"../vendor/QueryBuilder.php";

class
QueryBuilderTest extends \PHPUnit_Framework_TestCase
{
    public function
testSelect()
    {
       
$queryBuilder = new QueryBuilder();
       
$select_all_string = $queryBuilder
                           
->select()
                            ->
build();
       
$select_columns_string = $QueryBuilder
                           
->select("col1", "col2", "col3", "col4")
                            ->
build();
       
assertEquals($select_all_string, "SELECT *");
       
assertEquals($select_columns_string, "SELECT col1, col2, col3, col4");
    }

    public function
testInsert()
    {
       
$queryBuilder = new QueryBuilder();
       
$insert_string = $queryBuilder->insert()->build();

       
assetEquals($insert_string, "INSERT");
    }
}
?>