summaryrefslogtreecommitdiff
path: root/tests/unit/Web/THttpCookieTest.php
blob: c94282f16823cd1df738d8e3bfe21619217576eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

Prado::using('System.Web.THttpRequest');

/**
 * @package System.Web
 */
class THttpCookieTest extends PHPUnit_Framework_TestCase {

  public function testConstruct() {
    $cookie=new THttpCookie('name','value');
    self::assertEquals('name',$cookie->getName());
    self::assertEquals('value',$cookie->getValue());
  }

  public function testSetDomain() {
    $cookie=new THttpCookie('name','value');
    $cookie->setDomain('pradoframework.net');
    self::assertEquals('pradoframework.net',$cookie->getdomain());
  }

  public function testSetExpire() {
    $cookie=new THttpCookie('name','value');
    $exp=time()+3600;
    $cookie->setExpire($exp);
    self::assertEquals($exp,$cookie->getExpire());
  }

  public function testSetName() {
     $cookie=new THttpCookie('name','value');
     $cookie->setName('newName');
     self::assertEquals('newName', $cookie->getName());
  }

  public function testSetValue() {
    $cookie=new THttpCookie('name','value');
    $cookie->setValue('newValue');
    self::assertEquals('newValue', $cookie->getValue());
  }

  public function testSetPath() {
    $cookie=new THttpCookie('name','value');
    $cookie->setPath('/admin');
    self::assertEquals('/admin', $cookie->getPath());
  }

  public function testSetSecure() {
    $cookie=new THttpCookie('name','value');
    $cookie->setSecure(true);
    self::assertTrue($cookie->getSecure());
  }
}