Skip to content

Commit 1c246d3

Browse files
committed
docs: add comments
1 parent 4a45833 commit 1c246d3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/system/Database/Builder/WhereTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,11 @@ public function testWhereValueIsFloat()
488488
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
489489
}
490490

491+
/**
492+
* The current behavior assumes MySQL.
493+
* Other databases may not work well, so we may want to change the behavior
494+
* to match the specifications of the database driver.
495+
*/
491496
public function testWhereValueIsTrue()
492497
{
493498
$builder = $this->db->table('users');
@@ -498,6 +503,11 @@ public function testWhereValueIsTrue()
498503
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
499504
}
500505

506+
/**
507+
* The current behavior assumes MySQL.
508+
* Other databases may not work well, so we may want to change the behavior
509+
* to match the specifications of the database driver.
510+
*/
501511
public function testWhereValueIsFalse()
502512
{
503513
$builder = $this->db->table('users');
@@ -508,6 +518,9 @@ public function testWhereValueIsFalse()
508518
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
509519
}
510520

521+
/**
522+
* Check if SQL injection is not possible when unexpected values are passed
523+
*/
511524
public function testWhereValueIsArray()
512525
{
513526
$builder = $this->db->table('users');
@@ -521,6 +534,9 @@ public function testWhereValueIsArray()
521534
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
522535
}
523536

537+
/**
538+
* Check if SQL injection is not possible when unexpected values are passed
539+
*/
524540
public function testWhereValueIsArrayOfArray()
525541
{
526542
$this->expectException(ErrorException::class);
@@ -533,6 +549,9 @@ public function testWhereValueIsArrayOfArray()
533549
$builder->getCompiledSelect();
534550
}
535551

552+
/**
553+
* Check if SQL injection is not possible when unexpected values are passed
554+
*/
536555
public function testWhereValueIsArrayOfObject()
537556
{
538557
$this->expectException(Error::class);
@@ -555,6 +574,9 @@ public function testWhereValueIsNull()
555574
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
556575
}
557576

577+
/**
578+
* Check if SQL injection is not possible when unexpected values are passed
579+
*/
558580
public function testWhereValueIsStdClass()
559581
{
560582
$this->expectException(Error::class);
@@ -567,6 +589,9 @@ public function testWhereValueIsStdClass()
567589
$builder->getCompiledSelect();
568590
}
569591

592+
/**
593+
* Check if SQL injection is not possible when unexpected values are passed
594+
*/
570595
public function testWhereValueIsDateTime()
571596
{
572597
$this->expectException(Error::class);

0 commit comments

Comments
 (0)