IdentifierExpressionTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  7. *
  8. * Licensed under The MIT License
  9. * For full copyright and license information, please see the LICENSE.txt
  10. * Redistributions of files must retain the above copyright notice.
  11. *
  12. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  13. * @link https://cakephp.org CakePHP(tm) Project
  14. * @since 3.0.0
  15. * @license https://opensource.org/licenses/mit-license.php MIT License
  16. */
  17. namespace Cake\Test\TestCase\Database\Expression;
  18. use Cake\Database\Expression\IdentifierExpression;
  19. use Cake\Database\ValueBinder;
  20. use Cake\TestSuite\TestCase;
  21. /**
  22. * Tests IdentifierExpression class
  23. */
  24. class IdentifierExpressionTest extends TestCase
  25. {
  26. /**
  27. * Tests getting and setting the field
  28. *
  29. * @return void
  30. */
  31. public function testGetAndSet()
  32. {
  33. $expression = new IdentifierExpression('foo');
  34. $this->assertEquals('foo', $expression->getIdentifier());
  35. $expression->setIdentifier('bar');
  36. $this->assertEquals('bar', $expression->getIdentifier());
  37. }
  38. /**
  39. * Tests converting to sql
  40. *
  41. * @return void
  42. */
  43. public function testSQL()
  44. {
  45. $expression = new IdentifierExpression('foo');
  46. $this->assertEquals('foo', $expression->sql(new ValueBinder));
  47. }
  48. }