Skip to content

Commit 2d10ea9

Browse files
committed
Added unit tests for Response functions
1 parent 1c3968e commit 2d10ea9

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

tests/ImdbTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function testFilm()
1111
$film = $imdb->film('tt0816692');
1212

1313
$this->assertEquals('tt0816692', $film['id']);
14-
$this->assertEquals('Interstellar', $film['title']);
14+
$this->assertEquals('Interstellar  ', $film['title']);
1515
$this->assertEquals('2h 49min', $film['length']);
1616
$this->assertEquals('2014', $film['year']);
1717
}

tests/ResponseTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
use hmerritt\Response;
5+
6+
class ResponseTest extends TestCase {
7+
8+
public function testAddFunction()
9+
{
10+
$response = new Response;
11+
$response->add("id", "tt0816692");
12+
$response->add("title", "Interstellar");
13+
14+
$expected = [
15+
"id" => "tt0816692",
16+
"title" => "Interstellar"
17+
];
18+
19+
$this->assertEquals($expected, $response->store);
20+
}
21+
22+
public function testGetFunction()
23+
{
24+
$response = new Response;
25+
$response->add("title", "Interstellar");
26+
27+
$this->assertEquals("Interstellar", $response->get("title"));
28+
}
29+
30+
}

0 commit comments

Comments
 (0)