Skip to content

Commit cea11d0

Browse files
committed
Add a bunch of new structs to support new workflow methods
1 parent ee44ce8 commit cea11d0

12 files changed

+418
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
/**
6+
* Represents a config version item
7+
*/
8+
class WorkflowConfigVersion implements WorkflowConfigVersionInterface
9+
{
10+
/** @var string */
11+
private $configVersion;
12+
13+
/** @var int */
14+
private $createDate;
15+
16+
/** @var bool */
17+
private $latest;
18+
19+
public function __construct(
20+
string $configVersion = null,
21+
int $createDate = null,
22+
bool $latest = null
23+
) {
24+
$this->configVersion = $configVersion;
25+
$this->createDate = $createDate;
26+
$this->latest = $latest;
27+
}
28+
29+
public function getConfigVersion(): string
30+
{
31+
return $this->configVersion;
32+
}
33+
34+
public function getCreateDate(): int
35+
{
36+
return $this->createDate;
37+
}
38+
39+
public function getLatest(): bool
40+
{
41+
return $this->latest;
42+
}
43+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
use Scn\EvalancheSoapStruct\Struct\StructInterface;
6+
7+
/**
8+
* Represents a config version item
9+
*/
10+
interface WorkflowConfigVersionInterface extends StructInterface
11+
{
12+
public function getConfigVersion(): string;
13+
14+
public function getCreateDate(): int;
15+
16+
public function getLatest(): bool;
17+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
6+
7+
/**
8+
* Represents the result of a workflows getConfiguration call
9+
*/
10+
class WorkflowConfiguration implements WorkflowConfigurationInterface
11+
{
12+
/** @var string The current config version id */
13+
private $configVersion;
14+
15+
/** @var string The configuration as json encoded string */
16+
private $configuration;
17+
18+
public function __construct(
19+
string $configVersion = null,
20+
string $configuration = null
21+
) {
22+
$this->configVersion = $configVersion;
23+
$this->configuration = $configuration;
24+
}
25+
26+
public function getConfigVersion(): string
27+
{
28+
return $this->configVersion;
29+
}
30+
31+
public function getConfiguration(): string
32+
{
33+
return $this->configuration;
34+
}
35+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
use Scn\EvalancheSoapStruct\Struct\StructInterface;
6+
7+
/**
8+
* Represents the result of a workflows getConfiguration call
9+
*/
10+
interface WorkflowConfigurationInterface extends StructInterface
11+
{
12+
public function getConfigVersion(): string;
13+
14+
public function getConfiguration(): string;
15+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
/**
6+
* Represents a state change result
7+
*/
8+
class WorkflowStateChangeResult implements WorkflowStateChangeResultInterface
9+
{
10+
/** @var bool|null */
11+
private $stateChangeSuccessful;
12+
13+
/** @var WorkflowStateChangeResultErrorInterface[]|null */
14+
private $errorList;
15+
16+
/**
17+
* @param WorkflowStateChangeResultErrorInterface[]|null $errorList
18+
*/
19+
public function __construct(
20+
bool $stateChangeSuccessful = null,
21+
array $errorList = null
22+
) {
23+
$this->stateChangeSuccessful = $stateChangeSuccessful;
24+
$this->errorList = $errorList;
25+
}
26+
27+
public function getStateChangeResultSuccessful(): bool
28+
{
29+
return $this->stateChangeSuccessful;
30+
}
31+
32+
/**
33+
* @return WorkflowStateChangeResultErrorInterface[]
34+
*/
35+
public function getErrorList(): array
36+
{
37+
return $this->errorList;
38+
}
39+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
/**
6+
* Represents an error item which can occur in state change requests
7+
*/
8+
class WorkflowStateChangeResultError implements WorkflowStateChangeResultErrorInterface
9+
{
10+
/** @var string */
11+
private $type;
12+
13+
/** @var string */
14+
private $node;
15+
16+
/** @var string */
17+
private $param;
18+
19+
public function __construct(
20+
string $type = null,
21+
string $node = null,
22+
string $param = null
23+
) {
24+
$this->type = $type;
25+
$this->node = $node;
26+
$this->param = $param;
27+
}
28+
29+
public function getType(): string
30+
{
31+
return $this->type;
32+
}
33+
34+
public function getNode(): string
35+
{
36+
return $this->node;
37+
}
38+
39+
public function getParam(): string
40+
{
41+
return $this->param;
42+
}
43+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
6+
use Scn\EvalancheSoapStruct\Struct\StructInterface;
7+
8+
/**
9+
* Represents an error item which can occur in state change requests
10+
*/
11+
interface WorkflowStateChangeResultErrorInterface extends StructInterface
12+
{
13+
public function getType(): string;
14+
15+
public function getNode(): string;
16+
17+
public function getParam(): string;
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
use Scn\EvalancheSoapStruct\Struct\StructInterface;
6+
7+
/**
8+
* Represents a state change result
9+
*/
10+
interface WorkflowStateChangeResultInterface extends StructInterface
11+
{
12+
public function getStateChangeResultSuccessful(): bool;
13+
14+
/**
15+
* @return WorkflowStateChangeResultErrorInterface[]
16+
*/
17+
public function getErrorList(): array;
18+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
6+
7+
use Scn\EvalancheSoapStruct\StructTestCase;
8+
9+
class WorkflowConfigVersionTest extends StructTestCase
10+
{
11+
/** @var string */
12+
private $configVersion = 'some-config-version';
13+
14+
/** @var int */
15+
private $createDate = 1234567;
16+
17+
/** @var bool */
18+
private $latest = true;
19+
20+
/** @var WorkflowConfigVersion */
21+
private $subject;
22+
23+
public function setUp(): void
24+
{
25+
$this->subject = new WorkflowConfigVersion(
26+
$this->configVersion,
27+
$this->createDate,
28+
$this->latest
29+
);
30+
}
31+
32+
public function testGetConfigVersionReturnsValue(): void
33+
{
34+
$this->assertSame(
35+
$this->configVersion,
36+
$this->subject->getConfigVersion()
37+
);
38+
}
39+
40+
public function testGetCreateDateReturnsValue(): void
41+
{
42+
$this->assertSame(
43+
$this->createDate,
44+
$this->subject->getCreateDate()
45+
);
46+
}
47+
48+
public function testGetLatestReturnsTrue(): void
49+
{
50+
$this->assertTrue(
51+
$this->subject->getLatest()
52+
);
53+
}
54+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\Workflow;
4+
5+
use Scn\EvalancheSoapStruct\StructTestCase;
6+
7+
class WorkflowConfigurationTest extends StructTestCase
8+
{
9+
private $configVersion = 'some-config-version';
10+
11+
private $configuration = 'some-configuration';
12+
13+
/** @var WorkflowConfiguration */
14+
private $subject;
15+
16+
public function setUp(): void
17+
{
18+
$this->subject = new WorkflowConfiguration(
19+
$this->configVersion,
20+
$this->configuration
21+
);
22+
}
23+
24+
public function testGetConfigVersionReturnsValue(): void
25+
{
26+
$this->assertSame(
27+
$this->configVersion,
28+
$this->subject->getConfigVersion()
29+
);
30+
}
31+
32+
public function testGetConfigurationReturnsValus(): void
33+
{
34+
$this->assertSame(
35+
$this->configuration,
36+
$this->subject->getConfiguration()
37+
);
38+
}
39+
}

0 commit comments

Comments
 (0)