PHP Classes

File: tests/unit/Sql/OnduplicatekeyTest.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/Sql/OnduplicatekeyTest.php   Download  
File: tests/unit/Sql/OnduplicatekeyTest.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: 734 bytes
 

Contents

Class file image Download
<?php

class Sql_OnduplicatekeyTest extends UnitTestCase {

    public function
testSql_OnduplicatekeySameValue() {

       
$Sql_Onduplicatekey = new A_Sql_Onduplicatekey(array('foo', 'bar', 'baz'));
       
$query = $Sql_Onduplicatekey->render();

       
$this->assertEqual($query, 'ON DUPLICATE KEY UPDATE `foo` = VALUES(`foo`), `bar` = VALUES(`bar`), `baz` = VALUES(`baz`)');

    }

    public function
testSql_OnduplicatekeyDifferentValue() {

       
$Sql_Onduplicatekey = new A_Sql_Onduplicatekey(array(
           
'foo' => 'This is a value',
           
'bar' => 'This value has a \' in it',
        ));
       
$query = $Sql_Onduplicatekey->render();

       
$this->assertEqual($query, 'ON DUPLICATE KEY UPDATE `foo` = \'This is a value\', `bar` = \'This value has a \\\' in it\'');

    }

}