StringExpressionTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The Open Group Test Suite License
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 4.2.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Test\TestCase\Database\Expression;
  16. use Cake\Database\Expression\StringExpression;
  17. use Cake\Database\ValueBinder;
  18. use Cake\TestSuite\TestCase;
  19. /**
  20. * Tests StringExpression class
  21. */
  22. class StringExpressionTest extends TestCase
  23. {
  24. public function testCollation(): void
  25. {
  26. $expr = new StringExpression('testString', 'utf8_general_ci');
  27. $binder = new ValueBinder();
  28. $this->assertSame(':c0 COLLATE utf8_general_ci', $expr->sql($binder));
  29. $this->assertSame('testString', $binder->bindings()[':c0']['value']);
  30. $this->assertSame('string', $binder->bindings()[':c0']['type']);
  31. }
  32. }