10. class CalculatorTest
extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->calc = new Calculator;
}
public function test_add_ ()
{
$result = $this->calc->add(1, 2);
$this->assertSame(3, $result);
}
}
11. class CalculatorTest
extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->calc = new Calculator;
}
public function test_add_ ()
{
$result = $this->calc->add(1, 2);
$this->assertSame(3, $result);
}
}
12. class CalculatorTest
extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->calc = new Calculator;
}
public function test_add_ ()
{
$result = $this->calc->add(1, 2);
$this->assertSame(3, $result);
}
}
13. class CalculatorTest
extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->calc = new Calculator;
}
public function test_add_ ()
{
$result = $this->calc->add(1, 2);
$this->assertSame(3, $result);
}
}
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25. public function test_isValid_ true()
{
$user = new User;
$user->setName('Yuya');
$user->setUrl('http://yuyat.jp/');
$user->setAge(24);
$this->assertTrue($user->isValid());
}
public function test_isValid_ false()
{
$user = new User;
$user->setName('Yuya');
$user->setUrl('http://yuyat.jp/');
$user->setAge(NULL);
$this->assertFalse($user->isValid());
}
26. public function test_isValid_ true()
{
$user = new User;
$user->setName('Yuya');
$user->setUrl('http://yuyat.jp/');
$user->setAge(24);
$this->assertTrue($user->isValid());
}
public function test_isValid_ false()
{
$user = new User;
$user->setName('Yuya');
$user->setUrl('http://yuyat.jp/');
$user->setAge(NULL);
$this->assertFalse($user->isValid());
}
27. public function test_isValid_ true()
{
$user = $this->createValidUser();
$this->assertTrue($user->isValid());
}
public function test_isValid_ false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
}
28. public function test_isValid_ true()
{
$user = $this->createValidUser();
$this->assertTrue($user->isValid());
}
public function test_isValid_ false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
}
29. public function test_isValid_ true()
{
$user = $this->createValidUser();
$this->assertTrue($user->isValid());
}
public function test_isValid_ false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
}
30.
31. public function test_isValid_ false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
$user = $this->createValidUser();
$user->setName(NULL);
$this->assertFalse($user->isValid());
}
32. public function test_isValid_ false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
$user = $this->createValidUser();
$user->setName(NULL);
$this->assertFalse($user->isValid());
}
33. public function test_isValid_ false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
$user = $this->createValidUser();
$user->setName(NULL);
$this->assertFalse($user->isValid());
}
34. public function test_isValid_ Null false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
}
public function test_isValid_ Null false()
{
$user = $this->createValidUser();
$user->setName(NULL);
$this->assertFalse($user->isValid());
}
35. public function test_isValid_ Null false()
{
$user = $this->createValidUser();
$user->setAge(NULL);
$this->assertFalse($user->isValid());
}
public function test_isValid_ Null false()
{
$user = $this->createValidUser();
$user->setName(NULL);
$this->assertFalse($user->isValid());
}
41. public function test_isSsl_HTTPS true()
{
$_SERVER['HTTPS'] = 'on';
$this->assertTrue($this->request->isSsl());
}
public function test_isSsl_HTTPS false()
{
unset($_SERVER['HTTPS']);
$this->assertFalse($this->request->isSsl());
}
42. public function test_isSsl_HTTPS true()
{
$_SERVER['HTTPS'] = 'on';
$this->assertTrue($this->request->isSsl());
}
public function test_isSsl_HTTPS false()
{
unset($_SERVER['HTTPS']);
$this->assertFalse($this->request->isSsl());
}
43. public function test_isSsl_HTTPS true()
{
$_SERVER['HTTPS'] = 'on';
$this->assertTrue($this->request->isSsl());
}
public function test_isSsl_HTTPS false()
{
unset($_SERVER['HTTPS']);
$this->assertFalse($this->request->isSsl());
}
44. public function test_isSsl_HTTPS true()
{
$_SERVER['HTTPS'] = 'on';
$this->assertTrue($this->request->isSsl());
}
public function test_isSsl_HTTPS false()
{
unset($_SERVER['HTTPS']);
$this->assertFalse($this->request->isSsl());
}
45. class Request
{
public function __construct($server)
{
$this->_server = $server;
}
public function isSsl()
{
return $this->_server === 'on';
}
}
46. class Request
{
public function __construct($server)
{
$this->_server = $server;
}
public function isSsl()
{
return $this->_server === 'on';
}
}
47. public function test_isSsl_HTTPS true()
{
$request = new Request(array('HTTPS' => 'on'));
$this->assertTrue($request->isSsl());
}
public function test_isSsl_HTTPS false()
{
$request = new Request(array());
$this->assertFalse($request->isSsl());
}
48. public function test_isSsl_HTTPS true()
{
$request = new Request(array('HTTPS' => 'on'));
$this->assertTrue($request->isSsl());
}
public function test_isSsl_HTTPS false()
{
$request = new Request(array());
$this->assertFalse($request->isSsl());
}
49.
50.
51. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
public static function findByName($name) { /*~*/ }
public function save() { /*~*/ }
}
53. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
}
class UserMapper
{
public function findByName($name) { /*~*/ }
public function save(User $user) { /*~*/ }
}
54. $mapper = new UserMapper;
$user = $mapper->findByName('Bob');
$user->setName('Alice');
$mapper->save($user);
55. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
public static function findByName($name) { /*~*/ }
public function save() { /*~*/ }
}
56. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
public static function findByName($name) { /*~*/ }
public function save() { /*~*/ }
}
57. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
public static function findByName($name) { /*~*/ }
public function save() { /*~*/ }
}
58. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
public static function findByName($name) { /*~*/ }
public function save() { /*~*/ }
}
59. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
}
class UserMapper
{
public function findByName($name) { /*~*/ }
public function save(User $user) { /*~*/ }
}
60. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
}
class UserMapper
{
public function findByName($name) { /*~*/ }
public function save(User $user) { /*~*/ }
}
61. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
}
class UserMapper
{
public function findByName($name) { /*~*/ }
public function save(User $user) { /*~*/ }
}
62. class User
{
protected $_name;
protected $_birthday;
public function setName($name) { /*~*/ }
public function getName() { /*~*/ }
public function getAge() { /*~*/ }
}
class UserMapper
{
public function findByName($name) { /*~*/ }
public function save(User $user) { /*~*/ }
}
63. class Config
{
protected static $_instance;
private function __construct() {}
public static function getInstance()
{
if (empty(self::$_instance)) {
self::$_instance = new self;
}
return self::$_instance;
}
}