Skip to content

Commit 5b8066f

Browse files
committed
Moved integration tests from ClientTest to ClientIntegrationTest
1 parent 0a47c6e commit 5b8066f

File tree

2 files changed

+57
-91
lines changed

2 files changed

+57
-91
lines changed

tests/Elasticsearch/Tests/ClientIntegrationTest.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
use Elasticsearch\Client;
2222
use Elasticsearch\ClientBuilder;
23+
use Elasticsearch\Common\Exceptions\BadRequest400Exception;
2324
use Elasticsearch\Common\Exceptions\ElasticsearchException;
2425
use Elasticsearch\Common\Exceptions\Missing404Exception;
2526
use Elasticsearch\Tests\ClientBuilder\ArrayLogger;
@@ -96,6 +97,62 @@ public function testLogRequestFailHasWarning()
9697
}
9798
}
9899

100+
public function testIndexCannotBeEmptyStringForDelete()
101+
{
102+
$client = $this->getClient();
103+
104+
$this->expectException(Missing404Exception::class);
105+
106+
$client->delete(
107+
[
108+
'index' => '',
109+
'id' => 'test'
110+
]
111+
);
112+
}
113+
114+
public function testIdCannotBeEmptyStringForDelete()
115+
{
116+
$client = $this->getClient();
117+
118+
$this->expectException(BadRequest400Exception::class);
119+
120+
$client->delete(
121+
[
122+
'index' => 'test',
123+
'id' => ''
124+
]
125+
);
126+
}
127+
128+
public function testIndexCannotBeArrayOfEmptyStringsForDelete()
129+
{
130+
$client = $this->getClient();
131+
132+
$this->expectException(Missing404Exception::class);
133+
134+
$client->delete(
135+
[
136+
'index' => ['', '', ''],
137+
'id' => 'test'
138+
]
139+
);
140+
}
141+
142+
public function testIndexCannotBeArrayOfNullsForDelete()
143+
{
144+
$client = $this->getClient();
145+
146+
$this->expectException(Missing404Exception::class);
147+
148+
$client->delete(
149+
[
150+
'index' => [null, null, null],
151+
'id' => 'test'
152+
]
153+
);
154+
}
155+
99156
private function getLevelOutput(string $level, array $output): string
100157
{
101158
foreach ($output as $out) {

tests/Elasticsearch/Tests/ClientTest.php

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,6 @@ public function testIndexCannotBeNullForDelete()
106106
);
107107
}
108108

109-
public function testTypeCanBeNullForDelete()
110-
{
111-
$client = ClientBuilder::create()->build();
112-
113-
$this->expectException(Elasticsearch\Common\Exceptions\Missing404Exception::class);
114-
115-
$client->delete(
116-
[
117-
'index' => 'test',
118-
'type' => null,
119-
'id' => 'test'
120-
]
121-
);
122-
}
123-
124109
public function testIdCannotBeNullForDelete()
125110
{
126111
$client = ClientBuilder::create()->build();
@@ -131,87 +116,11 @@ public function testIdCannotBeNullForDelete()
131116
$client->delete(
132117
[
133118
'index' => 'test',
134-
'type' => 'test',
135119
'id' => null
136120
]
137121
);
138122
}
139123

140-
public function testIndexCannotBeEmptyStringForDelete()
141-
{
142-
$client = ClientBuilder::create()->build();
143-
144-
$this->expectException(Elasticsearch\Common\Exceptions\Missing404Exception::class);
145-
146-
$client->delete(
147-
[
148-
'index' => '',
149-
'type' => 'test',
150-
'id' => 'test'
151-
]
152-
);
153-
}
154-
155-
public function testTypeCannotBeEmptyStringForDelete()
156-
{
157-
$client = ClientBuilder::create()->build();
158-
159-
$this->expectException(Elasticsearch\Common\Exceptions\BadRequest400Exception::class);
160-
161-
$client->delete(
162-
[
163-
'index' => 'test',
164-
'type' => '',
165-
'id' => 'test'
166-
]
167-
);
168-
}
169-
170-
public function testIdCannotBeEmptyStringForDelete()
171-
{
172-
$client = ClientBuilder::create()->build();
173-
174-
$this->expectException(Elasticsearch\Common\Exceptions\BadRequest400Exception::class);
175-
176-
$client->delete(
177-
[
178-
'index' => 'test',
179-
'type' => 'test',
180-
'id' => ''
181-
]
182-
);
183-
}
184-
185-
public function testIndexCannotBeArrayOfEmptyStringsForDelete()
186-
{
187-
$client = ClientBuilder::create()->build();
188-
189-
$this->expectException(Elasticsearch\Common\Exceptions\Missing404Exception::class);
190-
191-
$client->delete(
192-
[
193-
'index' => ['', '', ''],
194-
'type' => 'test',
195-
'id' => 'test'
196-
]
197-
);
198-
}
199-
200-
public function testIndexCannotBeArrayOfNullsForDelete()
201-
{
202-
$client = ClientBuilder::create()->build();
203-
204-
$this->expectException(Elasticsearch\Common\Exceptions\Missing404Exception::class);
205-
206-
$client->delete(
207-
[
208-
'index' => [null, null, null],
209-
'type' => 'test',
210-
'id' => 'test'
211-
]
212-
);
213-
}
214-
215124
public function testMaxRetriesException()
216125
{
217126
$client = Elasticsearch\ClientBuilder::create()

0 commit comments

Comments
 (0)