PHP Classes

File: tests/unit/Sql/DeleteTest.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/Sql/DeleteTest.php   Download  
File: tests/unit/Sql/DeleteTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 1,226 bytes
 

Contents

Class file image Download
<?php

class Sql_DeleteTest extends UnitTestCase {
   
    function
setUp() {
    }
   
    function
TearDown() {
    }
   
    function
testSql_DeleteConstructorArgs() {
       
         
$Sql_Delete = new A_Sql_Delete();
         
$this->assertEqual($Sql_Delete->render(), '');

         
$Sql_Delete = new A_Sql_Delete('foo');
         
$this->assertEqual($Sql_Delete->render(), 'DELETE FROM foo');

         
$Sql_Delete = new A_Sql_Delete('foo', array('bar'=>1));
         
$this->assertEqual($Sql_Delete->render(), "DELETE FROM foo WHERE (bar = 1)");

         
$Sql_Delete = new A_Sql_Delete('foo', array('bar'=>1, 'faz'=>'baz'));
         
$this->assertEqual($Sql_Delete->render(), "DELETE FROM foo WHERE (bar = 1 AND faz = 'baz')");
    }
   
    function
testSql_DeleteTableWhere() {
       
         
$Sql_Delete = new A_Sql_Delete();
         
$this->assertEqual($Sql_Delete->table('foo')->render(), 'DELETE FROM foo');

         
$Sql_Delete = new A_Sql_Delete();
         
$this->assertEqual($Sql_Delete->table('foo')->where(array('bar'=>1))->render(), "DELETE FROM foo WHERE (bar = 1)");

         
$Sql_Delete = new A_Sql_Delete();
         
$this->assertEqual($Sql_Delete->table('foo')->where(array('bar'=>1, 'faz'=>'baz'))->render(), "DELETE FROM foo WHERE (bar = 1 AND faz = 'baz')");
    }
   
}