LocatorAwareTraitTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  10. * @link http://cakephp.org CakePHP(tm) Project
  11. * @since 3.1.0
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace Cake\Test\TestCase\ORM\Locator;
  15. use Cake\ORM\TableRegistry;
  16. use Cake\TestSuite\TestCase;
  17. /**
  18. * LocatorAwareTrait test case
  19. *
  20. */
  21. class LocatorAwareTraitTest extends TestCase
  22. {
  23. /**
  24. * setup
  25. *
  26. * @return void
  27. */
  28. public function setUp()
  29. {
  30. parent::setUp();
  31. $this->subject = $this->getObjectForTrait('Cake\ORM\Locator\LocatorAwareTrait');
  32. }
  33. /**
  34. * Tests tableLocator method
  35. *
  36. * @return void
  37. */
  38. public function testTableLocator()
  39. {
  40. $tableLocator = $this->subject->tableLocator();
  41. $this->assertSame(TableRegistry::locator(), $tableLocator);
  42. $newLocator = $this->getMock('Cake\ORM\Locator\LocatorInterface');
  43. $subjectLocator = $this->subject->tableLocator($newLocator);
  44. $this->assertSame($newLocator, $subjectLocator);
  45. }
  46. }