Ejemplo n.º 1
0
	function testInvalidateCookies() {
		$this->childResponse->addCookie('foo', 'bar');
		$this->childResponse->addCookie('bar', 'foo');
		$expected = array(
			'foo' => array(
				'value' => 'bar',
				'expireDate' => null
			),
			'bar' => array(
				'value' => 'foo',
				'expireDate' => null
			)
		);
		$cookies = $this->childResponse->getCookies();
		$this->assertEquals($expected, $cookies);

		$this->childResponse->invalidateCookies(array('foo', 'bar'));
		$expected = array(
			'foo' => array(
				'value' => 'expired',
				'expireDate' => new \DateTime('1971-01-01')
			),
			'bar' => array(
				'value' => 'expired',
				'expireDate' => new \DateTime('1971-01-01')
			)
		);

		$cookies = $this->childResponse->getCookies();
		$this->assertEquals($expected, $cookies);
	}