Completed
Push — master ( fe2892...6427ed )
by Oleg
03:03
created

EventsTest   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 401
Duplicated Lines 50.12 %

Coupling/Cohesion

Components 1
Dependencies 9

Importance

Changes 0
Metric Value
dl 201
loc 401
rs 10
c 0
b 0
f 0
wmc 13
lcom 1
cbo 9

7 Methods

Rating   Name   Duplication   Size   Complexity  
B testListAll() 0 40 1
B testGet() 0 37 1
A testCreateClickEvent() 50 50 1
B testCreateCustomEvent() 42 42 1
A testUpdateClickEvent() 50 50 1
B testUpdateCustomEvent() 42 42 1
C testIntegration() 17 131 7

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace OptimizelyPHPTest\Service\v2;
3
4
use OptimizelyPHPTest\Service\v2\BaseServiceTest;
5
use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient;
6
use WebMarketingROI\OptimizelyPHP\Result;
7
use WebMarketingROI\OptimizelyPHP\Service\v2\Events;
8
use WebMarketingROI\OptimizelyPHP\Resource\v2\Event;
9
use WebMarketingROI\OptimizelyPHP\Resource\v2\ClickEvent;
10
use WebMarketingROI\OptimizelyPHP\Resource\v2\CustomEvent;
11
use WebMarketingROI\OptimizelyPHP\Resource\v2\Project;
12
use WebMarketingROI\OptimizelyPHP\Resource\v2\Page;
13
14
class EventsTest extends BaseServiceTest
15
{
16
    public function testListAll()
17
    {
18
        // Mock 'OptimizelyApiClient' object to avoid real API calls
19
        $optimizelyApiClientMock = $this->getMockBuilder('\WebMarketingROI\OptimizelyPHP\OptimizelyApiClient')
20
                            ->disableOriginalConstructor()
21
                            ->getMock();
22
23
        $result = new Result(array(
24
                        array(
25
                            "archived" => true,
26
                            "category" => "add_to_cart",
27
                            "description" => "Item added to cart",
28
                            "event_filter" => array(
29
                              "filter_type" => "target_selector",
30
                              "selector" => ".menu-options"
31
                            ),
32
                            "event_type" => "custom",
33
                            "key" => "add_to_cart",
34
                            "name" => "Add to Cart",
35
                            "page_id" => 5000,
36
                            "project_id" => 1000,
37
                            "created" => "2016-10-18T05:07:04.136Z",
38
                            "id" => 0,
39
                            "is_classic" => false,
40
                            "is_editable" => true
41
                        )
42
                    ), 200);
43
        
44
        $optimizelyApiClientMock->method('sendApiRequest')
45
                    ->willReturn($result);
46
        
47
        $eventsService = new Events($optimizelyApiClientMock);
48
        
49
        $result = $eventsService->listAll(1000, true);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
50
        $events = $result->getPayload();
51
        
52
        $this->assertTrue(count($events)==1);
53
        $this->assertTrue($events[0] instanceOf Event);
54
        $this->assertTrue($events[0]->getName()=='Add to Cart');        
55
    }
56
    
57
    public function testGet()
58
    {
59
        // Mock 'OptimizelyApiClient' object to avoid real API calls
60
        $optimizelyApiClientMock = $this->getMockBuilder('\WebMarketingROI\OptimizelyPHP\OptimizelyApiClient')
61
                            ->disableOriginalConstructor()
62
                            ->getMock();
63
64
        $result = new Result(array(
65
                            "archived" => true,
66
                            "category" => "add_to_cart",
67
                            "description" => "Item added to cart",
68
                            "event_filter" => array(
69
                              "filter_type" => "target_selector",
70
                              "selector" => ".menu-options"
71
                            ),
72
                            "event_type" => "custom",
73
                            "key" => "add_to_cart",
74
                            "name" => "Add to Cart",
75
                            "page_id" => 5000,
76
                            "project_id" => 1000,
77
                            "created" => "2016-10-18T05:07:04.146Z",
78
                            "id" => 0,
79
                            "is_classic" => false,
80
                            "is_editable" => true
81
                        ), 200);
82
        
83
        $optimizelyApiClientMock->method('sendApiRequest')
84
                    ->willReturn($result);
85
        
86
        $eventsService = new Events($optimizelyApiClientMock);
87
        
88
        $result = $eventsService->get(5000);
0 ignored issues
show
Documentation introduced by
5000 is of type integer, but the function expects a object<WebMarketingROI\O...elyPHP\Service\v2\type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
89
        $event = $result->getPayload();
90
        
91
        $this->assertTrue($event instanceOf Event);
92
        $this->assertTrue($event->getName()=='Add to Cart');        
93
    }
94
    
95 View Code Duplication
    public function testCreateClickEvent()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
96
    {
97
        // Mock 'OptimizelyApiClient' object to avoid real API calls
98
        $optimizelyApiClientMock = $this->getMockBuilder('\WebMarketingROI\OptimizelyPHP\OptimizelyApiClient')
99
                            ->disableOriginalConstructor()
100
                            ->getMock();
101
102
        $result = new Result(array(
103
                              "event_filter" => array(
104
                                "filter_type" => "target_selector",
105
                                "selector" => ".menu-options"
106
                              ),
107
                              "name" => "Add to Cart",
108
                              "archived" => true,
109
                              "category" => "add_to_cart",
110
                              "description" => "string",
111
                              "event_type" => "click",
112
                              "key" => "add_to_cart",
113
                              "created" => "2016-10-18T05:07:04.153Z",
114
                              "id" => 0,
115
                              "is_classic" => false,
116
                              "is_editable" => true,
117
                              "page_id" => 0,
118
                              "project_id" => 1000
119
                        ), 201);
120
        
121
        $optimizelyApiClientMock->method('sendApiRequest')
122
                    ->willReturn($result);
123
        
124
        $eventsService = new Events($optimizelyApiClientMock);
125
        
126
        $event = new ClickEvent(array(
127
              "event_filter" => array(
128
                "filter_type" => "target_selector",
129
                "selector" => ".menu-options"
130
              ),
131
              "name" => "Add to Cart",
132
              "archived" => true,
133
              "category" => "add_to_cart",
134
              "description" => "string",
135
              "event_type" => "click",
136
              "key" => "add_to_cart"
137
        ));
138
        
139
        $result = $eventsService->createClickEvent(0, $event);
140
        $createdEvent = $result->getPayload();
141
        
142
        $this->assertTrue($createdEvent instanceOf ClickEvent);
143
        $this->assertTrue($createdEvent->getName()=='Add to Cart');                
144
    }
145
    
146 View Code Duplication
    public function testCreateCustomEvent()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
147
    {
148
        // Mock 'OptimizelyApiClient' object to avoid real API calls
149
        $optimizelyApiClientMock = $this->getMockBuilder('\WebMarketingROI\OptimizelyPHP\OptimizelyApiClient')
150
                            ->disableOriginalConstructor()
151
                            ->getMock();
152
153
        $result = new Result(array(
154
                            "archived" => true,
155
                            "category" => "add_to_cart",
156
                            "description" => "string",
157
                            "event_type" => "custom",
158
                            "key" => "loaded_new_app",
159
                            "name" => "Loaded New App",
160
                            "created" => "2016-10-18T05:07:04.163Z",
161
                            "id" => 0,
162
                            "is_classic" => false,
163
                            "is_editable" => true,
164
                            "page_id" => 0,
165
                            "project_id" => 1000  
166
                        ), 201);
167
        
168
        $optimizelyApiClientMock->method('sendApiRequest')
169
                    ->willReturn($result);
170
        
171
        $eventsService = new Events($optimizelyApiClientMock);
172
        
173
        $event = new CustomEvent(array(
174
                "archived" => true,
175
                "category" => "add_to_cart",
176
                "description" => "string",
177
                "event_type" => "custom",
178
                "key" => "loaded_new_app",
179
                "name" => "Loaded New App"
180
        ));
181
        
182
        $result = $eventsService->createCustomEvent(0, $event);
183
        $createdEvent = $result->getPayload();
184
        
185
        $this->assertTrue($createdEvent instanceOf CustomEvent);
186
        $this->assertTrue($createdEvent->getName()=='Loaded New App');                
187
    }
188
    
189 View Code Duplication
    public function testUpdateClickEvent()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
190
    {
191
        // Mock 'OptimizelyApiClient' object to avoid real API calls
192
        $optimizelyApiClientMock = $this->getMockBuilder('\WebMarketingROI\OptimizelyPHP\OptimizelyApiClient')
193
                            ->disableOriginalConstructor()
194
                            ->getMock();
195
196
        $result = new Result(array(
197
                              "event_filter" => array(
198
                                "filter_type" => "target_selector",
199
                                "selector" => ".menu-options"
200
                              ),
201
                              "name" => "Add to Cart",
202
                              "archived" => true,
203
                              "category" => "add_to_cart",
204
                              "description" => "string",
205
                              "event_type" => "click",
206
                              "key" => "add_to_cart",
207
                              "created" => "2016-10-18T05:07:04.153Z",
208
                              "id" => 0,
209
                              "is_classic" => false,
210
                              "is_editable" => true,
211
                              "page_id" => 0,
212
                              "project_id" => 1000
213
                        ), 200);
214
        
215
        $optimizelyApiClientMock->method('sendApiRequest')
216
                    ->willReturn($result);
217
        
218
        $eventsService = new Events($optimizelyApiClientMock);
219
        
220
        $event = new ClickEvent(array(
221
              "event_filter" => array(
222
                "filter_type" => "target_selector",
223
                "selector" => ".menu-options"
224
              ),
225
              "name" => "Add to Cart",
226
              "archived" => true,
227
              "category" => "add_to_cart",
228
              "description" => "string",
229
              "event_type" => "click",
230
              "key" => "add_to_cart"
231
        ));
232
        
233
        $result = $eventsService->updateClickEvent(0, 0, $event);
234
        $updatedEvent = $result->getPayload();
235
        
236
        $this->assertTrue($updatedEvent instanceOf ClickEvent);
237
        $this->assertTrue($updatedEvent->getName()=='Add to Cart');                
238
    }
239
    
240 View Code Duplication
    public function testUpdateCustomEvent()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
241
    {
242
        // Mock 'OptimizelyApiClient' object to avoid real API calls
243
        $optimizelyApiClientMock = $this->getMockBuilder('\WebMarketingROI\OptimizelyPHP\OptimizelyApiClient')
244
                            ->disableOriginalConstructor()
245
                            ->getMock();
246
247
        $result = new Result(array(
248
                            "archived" => true,
249
                            "category" => "add_to_cart",
250
                            "description" => "string",
251
                            "event_type" => "custom",
252
                            "key" => "loaded_new_app",
253
                            "name" => "Loaded New App",
254
                            "created" => "2016-10-18T05:07:04.163Z",
255
                            "id" => 0,
256
                            "is_classic" => false,
257
                            "is_editable" => true,
258
                            "page_id" => 0,
259
                            "project_id" => 1000  
260
                        ), 200);
261
        
262
        $optimizelyApiClientMock->method('sendApiRequest')
263
                    ->willReturn($result);
264
        
265
        $eventsService = new Events($optimizelyApiClientMock);
266
        
267
        $event = new CustomEvent(array(
268
                "archived" => true,
269
                "category" => "add_to_cart",
270
                "description" => "string",
271
                "event_type" => "custom",
272
                "key" => "loaded_new_app",
273
                "name" => "Loaded New App"
274
        ));
275
        
276
        $result = $eventsService->updateCustomEvent(0, 0, $event);
277
        $updatedEvent = $result->getPayload();
278
        
279
        $this->assertTrue($updatedEvent instanceOf CustomEvent);
280
        $this->assertTrue($updatedEvent->getName()=='Loaded New App');                
281
    }
282
    
283
    public function testIntegration()
284
    {
285
        if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) 
286
            $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set');
287
        
288
        $credentials = $this->loadCredentialsFromFile();
289
        
290
        $optimizelyClient = new OptimizelyApiClient($credentials, 'v2');
0 ignored issues
show
Bug introduced by
It seems like $credentials defined by $this->loadCredentialsFromFile() on line 288 can also be of type null; however, WebMarketingROI\Optimize...piClient::__construct() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
291
        $this->assertTrue($optimizelyClient!=null);
292
        
293
        // Create new project        
294
        $curDate = date('Y-m-d H:i:s');
295
        $newProject = new Project(array(
296
            "name" => "Test Project $curDate",
297
            "account_id" => 12345,
298
            "confidence_threshold" => 0.9,
299
            "platform" => "web",
300
            "status" => "active",
301
            "web_snippet" => array(
302
              "enable_force_variation" => false,
303
              "exclude_disabled_experiments" => false,
304
              "exclude_names" => true,
305
              "include_jquery" => true,
306
              "ip_anonymization" => false,
307
              "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
308
              "library" => "jquery-1.11.3-trim",
309
              "project_javascript" => "alert(\"Active Experiment\")"
310
            )
311
        ));
312
        
313
        $result = $optimizelyClient->projects()->create($newProject);
0 ignored issues
show
Documentation Bug introduced by
The method projects does not exist on object<WebMarketingROI\O...HP\OptimizelyApiClient>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
314
        $createdProject = $result->getPayload();
315
        
316
        // Create new page in the project
317
        $page = new Page(array(
318
            "edit_url" => "https://www.optimizely.com",
319
            "name" => "Home Page",
320
            "project_id" => $createdProject->getId(),
321
            "activation_code" => "string",
322
            "activation_type" => "immediate",
323
            "archived" => false,
324
            "category" => "article",
325
            "conditions" => "[\"and\", {\"type\": \"url\", \"match_type\": \"substring\", \"value\": \"optimize\"}]",
326
            "key" => "home_page",
327
            "page_type" => "single_url",
328
            "created" => "2016-10-18T05:07:04.113Z",
329
            "id" => 4000,
330
            "last_modified" => "2016-10-18T05:07:04.113Z"
331
        ));
332
        
333
        $result = $optimizelyClient->pages()->create($page);
0 ignored issues
show
Documentation Bug introduced by
The method pages does not exist on object<WebMarketingROI\O...HP\OptimizelyApiClient>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
334
        $createdPage = $result->getPayload();
335
        
336
        $this->assertTrue($createdPage instanceOf Page);
337
        $this->assertTrue($createdPage->getName()=='Home Page'); 
338
        
339
        // Create new event in the project
340
        $event = new ClickEvent(array(
341
              "event_filter" => array(
342
                "filter_type" => "target_selector",
343
                "selector" => ".menu-options"
344
              ),
345
              "name" => "Add to Cart",
346
              "archived" => true,
347
              "category" => "add_to_cart",
348
              "description" => "Some simple event",
349
              "event_type" => "click",
350
              "key" => "add_to_cart",
351
              "created" => "2016-10-18T05:07:04.153Z",
352
              "id" => 0,
353
              "is_classic" => false,
354
              "is_editable" => true,
355
              "page_id" => $createdPage->getId(),
356
              "project_id" => $createdProject->getId()
357
        ));
358
        
359
        $result = $optimizelyClient->events()->createClickEvent($createdPage->getId(), $event);
0 ignored issues
show
Documentation Bug introduced by
The method events does not exist on object<WebMarketingROI\O...HP\OptimizelyApiClient>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
360
        $createdEvent = $result->getPayload();
361
        
362
        $this->assertTrue($createdEvent instanceOf ClickEvent);
363
        $this->assertTrue($createdEvent->getName()=='Add to Cart');  
364
        
365
        // List all existing events and try to find the created event
366
        $eventFound = false;        
367
        try {
368
            $page = 1;
369 View Code Duplication
            for (;;) {                            
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
370
                $result = $optimizelyClient->events()->listAll($createdEvent->getId(), $page);
0 ignored issues
show
Documentation Bug introduced by
The method events does not exist on object<WebMarketingROI\O...HP\OptimizelyApiClient>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
371
372
                $events = $result->getPayload();
373
374
                foreach ($events as $event) {
375
                    if ($event->getName()=="Add to Cart") {
376
                        $eventFound = true;
377
                        break;
378
                    }
379
                }
380
381
                if ($result->getNextPage()==null)
382
                    break;
383
384
                $page ++;
385
            }
386
        }
387
        catch (Exception $e) {
0 ignored issues
show
Bug introduced by
The class OptimizelyPHPTest\Service\v2\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
388
            // Handle error.
389
            $code = $e->getCode();
390
            $httpCode = $e->getHttpCode();
391
            $message = $e->getMessage();
392
            $uuid = $e->getUuid();
393
            echo "Exception caught: $message (code=$code http_code=$httpCode uuid=$uuid)\n";
394
        }
395
        
396
        $this->assertTrue($eventFound);
397
        
398
        // Update page
399
        $createdEvent->setName('Add to Cart 2');
400
        $result = $optimizelyClient->events()->update($createdEvent->getId(), $createdEvent);
0 ignored issues
show
Documentation Bug introduced by
The method events does not exist on object<WebMarketingROI\O...HP\OptimizelyApiClient>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
401
        $updatedEvent = $result->getPayload();                
402
        
403
        $this->assertTrue($updatedEvent instanceOf Event);
404
        $this->assertTrue($updatedEvent->getName()=='Add to Cart 2');  
405
        
406
        // Make project archived
407
        
408
        $createdProject->setStatus('archived');
409
        $result = $optimizelyClient->projects()->update($createdProject->getId(), $createdProject);
0 ignored issues
show
Documentation Bug introduced by
The method projects does not exist on object<WebMarketingROI\O...HP\OptimizelyApiClient>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
410
        $updatedProject = $result->getPayload();
411
        
412
        $this->assertEquals('archived', $updatedProject->getStatus());
413
    }
414
}
415
416