Skip to content

Commit 61f03e5

Browse files
authored
Merge pull request #323 from cnovak/320-missing-splat
#320 Fix ApiProduct Entity setProxies() runtime error
2 parents c564d04 + c95b94e commit 61f03e5

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

src/Entity/ApiProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getProxies(): array {
109109
* {@inheritdoc}
110110
*/
111111
public function setProxies(string ...$proxy): void {
112-
$this->decorated->setProxies($proxy);
112+
$this->decorated->setProxies(...$proxy);
113113
}
114114

115115
/**
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
3+
/**
4+
* Copyright 2020 Google Inc.
5+
*
6+
* This program is free software; you can redistribute it and/or modify it under
7+
* the terms of the GNU General Public License version 2 as published by the
8+
* Free Software Foundation.
9+
*
10+
* This program is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13+
* License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License along
16+
* with this program; if not, write to the Free Software Foundation, Inc., 51
17+
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
*/
19+
20+
use Drupal\apigee_edge\Entity\ApiProduct;
21+
use Drupal\Tests\UnitTestCase;
22+
23+
/**
24+
* Test ApiProductTest class.
25+
*
26+
* @group apigee_edge
27+
*/
28+
class ApiProductTest extends UnitTestCase {
29+
30+
/**
31+
* The API Product under test.
32+
*
33+
* @var \Drupal\apigee_edge\Entity\ApiProduct
34+
*/
35+
private $apiProduct;
36+
37+
/**
38+
* {@inheritdoc}
39+
*/
40+
protected function setUp() {
41+
parent::setUp();
42+
$this->apiProduct = new ApiProduct([]);
43+
}
44+
45+
/**
46+
* Test setting proxies.
47+
*/
48+
public function testSetProxies() {
49+
$proxies_expected = ['proxy1', 'proxy2'];
50+
$this->apiProduct->setProxies(...$proxies_expected);
51+
$proxies_actual = $this->apiProduct->getProxies();
52+
$this->assertArrayEquals($proxies_expected, $proxies_actual);
53+
54+
}
55+
56+
/**
57+
* Test setting scopes.
58+
*/
59+
public function testSetScopes() {
60+
$scopes_expected = ['scope1', 'scope2'];
61+
$this->apiProduct->setScopes(...$scopes_expected);
62+
$scopes_actual = $this->apiProduct->getScopes();
63+
$this->assertArrayEquals($scopes_expected, $scopes_actual);
64+
65+
}
66+
67+
/**
68+
* Test setting environments.
69+
*/
70+
public function testSetEnvironments() {
71+
$environments_expected = ['environment1', 'environment2'];
72+
$this->apiProduct->setEnvironments(...$environments_expected);
73+
$environments_actual = $this->apiProduct->getEnvironments();
74+
$this->assertArrayEquals($environments_expected, $environments_actual);
75+
}
76+
77+
}

0 commit comments

Comments
 (0)