Skip to content

Commit

Permalink
feat: refactor existing method names
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Aug 28, 2024
1 parent 1d00545 commit 207313a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Once you have initialised your Orchestration object the following methods can be
This method creates a new network and returns a boolean value indicating if the network was created successfully.

```php
$orchestration->createNetwork('name', false);
$orchestration->networkCreate('name', false);
```

<details>
Expand All @@ -305,7 +305,7 @@ Once you have initialised your Orchestration object the following methods can be
This method removes a network and returns a boolean value indicating if the network was removed successfully.

```php
$orchestration->removeNetwork('network_id');
$orchestration->networkRemove('network_id');
```

<details>
Expand Down
4 changes: 2 additions & 2 deletions src/Orchestration/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public function filterEnvKey(string $string): string
/**
* Create Network
*/
abstract public function createNetwork(string $name, bool $internal = false): bool;
abstract public function networkCreate(string $name, bool $internal = false): bool;

/**
* Remove Network
*/
abstract public function removeNetwork(string $name): bool;
abstract public function networkRemove(string $name): bool;

/**
* Connect a container to a network
Expand Down
4 changes: 2 additions & 2 deletions src/Orchestration/Adapter/DockerAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected function streamCall(string $url, int $timeout = -1): array
/**
* Create Network
*/
public function createNetwork(string $name, bool $internal = false): bool
public function networkCreate(string $name, bool $internal = false): bool
{
$body = \json_encode([
'Name' => $name,
Expand All @@ -225,7 +225,7 @@ public function createNetwork(string $name, bool $internal = false): bool
/**
* Remove Network
*/
public function removeNetwork(string $name): bool
public function networkRemove(string $name): bool
{
$result = $this->call('http://localhost/networks/'.$name, 'DELETE');

Expand Down
4 changes: 2 additions & 2 deletions src/Orchestration/Adapter/DockerCLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(?string $username = null, ?string $password = null)
/**
* Create Network
*/
public function createNetwork(string $name, bool $internal = false): bool
public function networkCreate(string $name, bool $internal = false): bool
{
$output = '';

Expand All @@ -43,7 +43,7 @@ public function createNetwork(string $name, bool $internal = false): bool
/**
* Remove Network
*/
public function removeNetwork(string $name): bool
public function networkRemove(string $name): bool
{
$output = '';

Expand Down
8 changes: 4 additions & 4 deletions src/Orchestration/Orchestration.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ public function parseCommandString(string $command): array
/**
* Create Network
*/
public function createNetwork(string $name, bool $internal = false): bool
public function networkCreate(string $name, bool $internal = false): bool
{
return $this->adapter->createNetwork($name, $internal);
return $this->adapter->networkCreate($name, $internal);
}

/**
* Remove Network
*/
public function removeNetwork(string $name): bool
public function networkRemove(string $name): bool
{
return $this->adapter->removeNetwork($name);
return $this->adapter->networkRemove($name);
}

/**
Expand Down
16 changes: 8 additions & 8 deletions tests/Orchestration/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ public function testCreateContainer(): void
/**
* @depends testCreateContainer
*/
public function testCreateNetwork(): void
public function testNetworkCreate(): void
{
$response = static::getOrchestration()->createNetwork('TestNetwork');
$response = static::getOrchestration()->networkCreate('TestNetwork');

$this->assertEquals(true, $response);
}

/**
* @depends testCreateNetwork
* @depends testNetworkCreate
*/
public function testListNetworks(): void
{
Expand All @@ -211,7 +211,7 @@ public function testListNetworks(): void
}

/**
* @depends testCreateNetwork
* @depends testNetworkCreate
*/
public function testNetworkConnect(): void
{
Expand Down Expand Up @@ -260,9 +260,9 @@ public function testNetworkDisconnect(): void
/**
* @depends testNetworkDisconnect
*/
public function testRemoveNetwork(): void
public function testNetworkRemove(): void
{
$response = static::getOrchestration()->removeNetwork('TestNetwork');
$response = static::getOrchestration()->networkRemove('TestNetwork');

$this->assertEquals(true, $response);
}
Expand Down Expand Up @@ -725,12 +725,12 @@ public function testNetworkExists(): void
$this->assertFalse(static::getOrchestration()->networkExists($networkName));

// Create network and test it exists
$response = static::getOrchestration()->createNetwork($networkName);
$response = static::getOrchestration()->networkCreate($networkName);
$this->assertTrue($response);
$this->assertTrue(static::getOrchestration()->networkExists($networkName));

// Remove network
$response = static::getOrchestration()->removeNetwork($networkName);
$response = static::getOrchestration()->networkRemove($networkName);
$this->assertTrue($response);

// Test removed network
Expand Down

0 comments on commit 207313a

Please sign in to comment.