IdentifierExpressionTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * PHP Version 5.4
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org)
  13. * @link http://cakephp.org CakePHP(tm) Project
  14. * @since CakePHP(tm) v 3.0.0
  15. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  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. **/
  25. class IdentifierExpressionTest extends TestCase {
  26. /**
  27. * Tests getting and setting the field
  28. *
  29. * @return
  30. */
  31. public function testGetAndSet() {
  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. $expression = new IdentifierExpression('foo');
  44. $this->assertEquals('foo', $expression->sql(new ValueBinder));
  45. }
  46. }