IdentifierExpressionTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. *
  4. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * For full copyright and license information, please see the LICENSE.txt
  9. * Redistributions of files must retain the above copyright notice.
  10. *
  11. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  12. * @link http://cakephp.org CakePHP(tm) Project
  13. * @since 3.0.0
  14. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  15. */
  16. namespace Cake\Test\TestCase\Database\Expression;
  17. use Cake\Database\Expression\IdentifierExpression;
  18. use Cake\Database\ValueBinder;
  19. use Cake\TestSuite\TestCase;
  20. /**
  21. * Tests IdentifierExpression class
  22. *
  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. }