DeleteTest.php 973 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Test\Michel\SqlMapper;
  3. use Michel\UniTester\TestCase;
  4. use Michel\SqlMapper\Delete;
  5. class DeleteTest extends TestCase
  6. {
  7. protected function setUp(): void
  8. {
  9. // TODO: Implement setUp() method.
  10. }
  11. protected function tearDown(): void
  12. {
  13. // TODO: Implement tearDown() method.
  14. }
  15. protected function execute(): void
  16. {
  17. $this->testToStringWithConditions();
  18. $this->testToStringWithoutConditions();
  19. }
  20. public function testToStringWithoutConditions()
  21. {
  22. $delete = new Delete('table_name');
  23. $this->assertEquals('DELETE FROM table_name', $delete->__toString());
  24. }
  25. public function testToStringWithConditions()
  26. {
  27. $delete = new Delete('table_name');
  28. $delete->where('condition1', 'condition2');
  29. $this->assertEquals('DELETE FROM table_name WHERE condition1 AND condition2', $delete->__toString());
  30. }
  31. }