FunctionsGlobalTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://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. (https://cakefoundation.org)
  12. * @link https://cakephp.org CakePHP(tm) Project
  13. * @since 4.5.0
  14. * @license https://opensource.org/licenses/mit-license.php MIT License
  15. */
  16. namespace Cake\Test\TestCase\Collection;
  17. use Cake\Collection\Collection;
  18. use Cake\TestSuite\TestCase;
  19. require_once CAKE . 'Collection/functions_global.php';
  20. /**
  21. * FunctionsGlobalTest class
  22. */
  23. class FunctionsGlobalTest extends TestCase
  24. {
  25. /**
  26. * Tests that the collection() method is a shortcut for new Collection
  27. */
  28. public function testCollection(): void
  29. {
  30. $items = [1, 2, 3];
  31. $collection = collection($items);
  32. $this->assertInstanceOf(Collection::class, $collection);
  33. $this->assertSame($items, $collection->toArray());
  34. }
  35. }