IdentifierExpressionTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. class IdentifierExpressionTest extends TestCase
  24. {
  25. /**
  26. * Tests getting and setting the field
  27. *
  28. * @return void
  29. */
  30. public function testGetAndSet()
  31. {
  32. $expression = new IdentifierExpression('foo');
  33. $this->assertEquals('foo', $expression->getIdentifier());
  34. $expression->setIdentifier('bar');
  35. $this->assertEquals('bar', $expression->getIdentifier());
  36. }
  37. /**
  38. * Tests converting to sql
  39. *
  40. * @return void
  41. */
  42. public function testSQL()
  43. {
  44. $expression = new IdentifierExpression('foo');
  45. $this->assertEquals('foo', $expression->sql(new ValueBinder));
  46. }
  47. }