Skip to content

Commit 69e7537

Browse files
committed
unit tests
0 parents  commit 69e7537

File tree

1,174 files changed

+109136
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,174 files changed

+109136
-0
lines changed

app/Models/User.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
class User
6+
{
7+
public $first_name;
8+
public $last_name;
9+
public $email;
10+
11+
public function setFirstName($FirstName)
12+
{
13+
$this->first_name = trim($FirstName);
14+
}
15+
16+
public function getFirstName()
17+
{
18+
return $this->first_name;
19+
}
20+
21+
public function setLastName($LastName)
22+
{
23+
$this->last_name = trim($LastName);
24+
}
25+
26+
public function getLastName()
27+
{
28+
return $this->last_name;
29+
}
30+
31+
public function setEmail($Email)
32+
{
33+
$this->email = $email;
34+
}
35+
36+
public function getEmail()
37+
{
38+
return $this->email;
39+
}
40+
41+
public function getFullName()
42+
{
43+
return $this->first_name.' '.$this->last_name;
44+
}
45+
46+
public function getEmailVariables()
47+
{
48+
return [
49+
'full_name'=>$this->getFullName(),
50+
'email'=>$this->getEmail()
51+
];
52+
}
53+
}
54+
?>

app/Support/Collection.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Support;
4+
5+
use IteratorAggregate;
6+
use ArrayIterator;
7+
use JsonSerializable;
8+
9+
class Collection implements IteratorAggregate, JsonSerializable
10+
{
11+
protected $items = [];
12+
13+
public function __construct(array $items=[] )
14+
{
15+
$this->items = $items;
16+
}
17+
18+
public function get()
19+
{
20+
return $this->items;
21+
}
22+
23+
public function getCount()
24+
{
25+
return sizeof($this->items);
26+
}
27+
28+
public function getIterator()
29+
{
30+
return new ArrayIterator($this->items);
31+
}
32+
33+
public function toJson()
34+
{
35+
return json_encode($this->items);
36+
}
37+
38+
public function jsonSerialize()
39+
{
40+
return $this->items;
41+
}
42+
}

composer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"require": {
3+
"phpunit/phpunit": "^4.8"
4+
},
5+
"autoload":{
6+
"psr-4":{
7+
"App\\":"app"
8+
}
9+
}
10+
11+
}

0 commit comments

Comments
 (0)