| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- /**
- * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
- * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://cakephp.org CakePHP(tm) Project
- * @since 3.5.0
- * @license http://www.opensource.org/licenses/mit-license.php MIT License
- */
- namespace Cake\Test\TestCase\Http\Cookie;
- use Cake\Http\Cookie\Cookie;
- use Cake\Http\Cookie\CookieCollection;
- use Cake\TestSuite\TestCase;
- /**
- * Cookie collection test.
- */
- class CookieCollectionTest extends TestCase
- {
- /**
- * Test constructor
- *
- * @return void
- */
- public function testConstructorWithEmptyArray()
- {
- $collection = new CookieCollection([]);
- $this->assertCount(0, $collection);
- }
- /**
- * Test valid cookies
- *
- * @return void
- */
- public function testConstructorWithCookieArray()
- {
- $cookies = [
- new Cookie('one', 'one'),
- new Cookie('two', 'two')
- ];
- $collection = new CookieCollection($cookies);
- $this->assertCount(2, $collection);
- }
- /**
- * Test that the constructor takes only an array of objects implementing
- * the CookieInterface
- *
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Expected `Cake\Http\Cookie\CookieCollection[]` as $cookies but instead got `array` at index 1
- * @return void
- */
- public function testConstructorWithInvalidCookieObjects()
- {
- $array = [
- new Cookie('one', 'one'),
- []
- ];
- new CookieCollection($array);
- }
- }
|