InsertTest.php 996 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Test\Michel\SqlMapper;
  3. use Michel\SqlMapper\Insert;
  4. use Michel\UniTester\TestCase;
  5. class InsertTest extends TestCase
  6. {
  7. protected function execute(): void
  8. {
  9. $this->testConstructor();
  10. $this->testSetValue();
  11. }
  12. public function testConstructor()
  13. {
  14. $insert = new Insert('my_table');
  15. $this->expectException(\LogicException::class , function () use ($insert) {
  16. $insert->__toString();
  17. });
  18. }
  19. public function testSetValue()
  20. {
  21. $insert = new Insert('my_table');
  22. $insert->setValue('column1', 'value1')->setValue('column2', 'value2');
  23. $this->assertEquals('INSERT INTO my_table (column1, column2) VALUES (value1, value2)', (string)$insert);
  24. }
  25. protected function setUp(): void
  26. {
  27. // TODO: Implement setUp() method.
  28. }
  29. protected function tearDown(): void
  30. {
  31. // TODO: Implement tearDown() method.
  32. }
  33. }