instance = new Create(); } public function testGetURIWhenIndexAndIdAreDefined(): void { // Arrange $expected = '/index/_create/10'; $this->instance->setIndex('index'); $this->instance->setId(10); // Act $result = $this->instance->getURI(); // Assert $this->assertEquals($expected, $result); } public function testGetURIWhenIndexIsDefinedAndIdIsNotDefined(): void { // Arrange $expected = '/index/_doc'; $this->instance->setIndex('index'); // Act $result = $this->instance->getURI(); // Assert $this->assertEquals($expected, $result); } public function testGetURIWhenIndexIsNotDefined(): void { // Arrange $expected = RuntimeException::class; $expectedMessage = 'index is required for create'; // Assert $this->expectException($expected); $this->expectExceptionMessage($expectedMessage); // Act $this->instance->getURI(); } public function testGetMethodWhenIdIsDefined(): void { // Arrange $expected = 'PUT'; $this->instance->setId(10); // Act $result = $this->instance->getMethod(); // Assert $this->assertEquals($expected, $result); } public function testGetMethodWhenIdIsNotDefined(): void { // Arrange $expected = 'POST'; // Act $result = $this->instance->getMethod(); // Assert $this->assertEquals($expected, $result); } }