Skip to content

Commit cf902eb

Browse files
committed
Add taskroot() accessor
1 parent 6491538 commit cf902eb

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ AWS Lambda change log
33

44
## ?.?.? / ????-??-??
55

6+
## 1.1.0 / 2021-08-28
7+
8+
* Added accessor for environment root path, `Environment::taskroot()`
9+
(@thekid)
10+
611
## 1.0.0 / 2021-08-28
712

813
* Merged PR #5: Unique given sources, preventing them being added to the

src/main/php/com/amazon/aws/lambda/Environment.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ public function __construct(string $root, StringWriter $writer= null) {
2121
$this->properties= new FilesystemPropertySource($root);
2222
}
2323

24+
/** Returns this environment's root path */
25+
public function taskroot(): Path { return new Path($this->root); }
26+
2427
/** Returns a path inside this environment's root path */
25-
public function path(string $path): Path {
26-
return new Path($this->root, $path);
27-
}
28+
public function path(string $path): Path { return new Path($this->root, $path); }
2829

2930
/**
3031
* Writes a trace message

src/test/php/com/amazon/aws/lambda/unittest/EnvironmentTest.class.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public function can_create() {
1515
new Environment('.');
1616
}
1717

18+
#[Test]
19+
public function taskroot() {
20+
Assert::equals(new Path('.'), (new Environment('.'))->taskroot());
21+
}
22+
1823
#[Test]
1924
public function path() {
2025
Assert::equals(new Path('./etc'), (new Environment('.'))->path('etc'));

0 commit comments

Comments
 (0)