4
4
5
5
use DayRev \Smmry \SDK ;
6
6
use Mockery ;
7
- use ReflectionProperty ;
8
7
use stdClass ;
9
8
10
9
class SDKTest extends TestCase
11
10
{
12
11
protected $ sdk ;
13
- protected $ mock = true ;
14
12
15
13
public function setUp ()
16
14
{
@@ -19,14 +17,6 @@ public function setUp()
19
17
20
18
public function testSummarizesExpectedText ()
21
19
{
22
- if ($ this ->mock ) {
23
- $ requester = Mockery::mock ('Curl ' )
24
- ->shouldReceive ('post ' )
25
- ->andReturn ($ this ->getExpectedTextSummary ())
26
- ->getMock ();
27
- $ this ->setProtectedSDKProperty ($ this ->sdk , 'requester ' , $ requester );
28
- }
29
-
30
20
$ response = $ this ->sdk ->summarizeText ($ this ->getTextToSummarize ());
31
21
32
22
$ this ->assertInstanceOf ('stdClass ' , $ response );
@@ -36,28 +26,15 @@ public function testSummarizesExpectedText()
36
26
37
27
public function testSummarizesExpectedUrlText ()
38
28
{
39
- if ($ this ->mock ) {
40
- $ requester = Mockery::mock ('Curl ' )
41
- ->shouldReceive ('get ' )
42
- ->andReturn ($ this ->getExpectedUrlTextSummary ())
43
- ->getMock ();
44
- $ this ->setProtectedSDKProperty ($ this ->sdk , 'requester ' , $ requester );
45
- }
46
-
47
- $ response = $ this ->sdk ->summarizeUrl ('http://collegefootball.ap.org/article/mayfield-leads-oklahoma-35-19-sugar-bowl-win-over-auburn ' );
29
+ $ response = $ this ->sdk ->summarizeUrl (
30
+ 'http://collegefootball.ap.org/article/mayfield-leads-oklahoma-35-19-sugar-bowl-win-over-auburn '
31
+ );
48
32
49
33
$ this ->assertInstanceOf ('stdClass ' , $ response );
50
34
$ this ->assertObjectHasAttribute ('sm_api_content ' , $ response );
51
35
$ this ->assertEquals ($ this ->getExpectedUrlTextSummary ()->sm_api_content , $ response ->sm_api_content );
52
36
}
53
37
54
- protected function setProtectedSDKProperty (SDK $ sdk , string $ property , $ value )
55
- {
56
- $ reflected_property = new ReflectionProperty (get_class ($ sdk ), $ property );
57
- $ reflected_property ->setAccessible (true );
58
- $ reflected_property ->setValue ($ sdk , $ value );
59
- }
60
-
61
38
protected function getExpectedSummary (string $ text ): stdClass
62
39
{
63
40
$ summary = new stdClass ();
0 commit comments