LocatorAwareTraitTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. class LocatorAwareTraitTest extends TestCase
  21. {
  22. /**
  23. * setup
  24. *
  25. * @return void
  26. */
  27. public function setUp()
  28. {
  29. parent::setUp();
  30. $this->subject = $this->getObjectForTrait('Cake\ORM\Locator\LocatorAwareTrait');
  31. }
  32. /**
  33. * Tests tableLocator method
  34. *
  35. * @return void
  36. */
  37. public function testTableLocator()
  38. {
  39. $tableLocator = $this->subject->tableLocator();
  40. $this->assertSame(TableRegistry::locator(), $tableLocator);
  41. $newLocator = $this->getMockBuilder('Cake\ORM\Locator\LocatorInterface')->getMock();
  42. $subjectLocator = $this->subject->tableLocator($newLocator);
  43. $this->assertSame($newLocator, $subjectLocator);
  44. }
  45. }