IdentifierExpressionTest.php 1.3 KB

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