Skip to content

Commit 988ac40

Browse files
committed
Fix etl
1 parent b124eb2 commit 988ac40

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/Etl.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ public function extract($extractor, $input, $options = [])
5858
{
5959
$extractor = $this->container->step($extractor, Extractor::class);
6060

61-
$options['input'] = $input;
62-
63-
$extractor->options($options);
61+
$extractor->input($input)->options($options);
6462

6563
$this->pipeline->extractor($extractor);
6664

@@ -97,9 +95,7 @@ public function load($loader, $output, $options = [])
9795
{
9896
$loader = $this->container->step($loader, Loader::class);
9997

100-
$options['output'] = $output;
101-
102-
$loader->options($options);
98+
$loader->output($output)->options($options);
10399

104100
$this->pipeline->pipe($loader);
105101

tests/EtlTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class EtlTest extends TestCase
1111
public function extract_step()
1212
{
1313
$extractor = $this->createMock('Marquine\Etl\Extractors\Extractor');
14-
$extractor->expects($this->once())->method('options')->with(['option' => 'value', 'input' => 'input']);
14+
$extractor->expects($this->once())->method('input')->with('input')->willReturnSelf();
15+
$extractor->expects($this->once())->method('options')->with(['options']);
1516

1617
$container = $this->createMock('Marquine\Etl\Container');
1718
$container->expects($this->once())->method('step')->with('step_name', 'Marquine\Etl\Extractors\Extractor')->willReturn($extractor);
@@ -21,14 +22,14 @@ public function extract_step()
2122

2223
$etl = new Etl($container, $pipeline);
2324

24-
$this->assertInstanceOf(Etl::class, $etl->extract('step_name', 'input', ['option' => 'value']));
25+
$this->assertInstanceOf(Etl::class, $etl->extract('step_name', 'input', ['options']));
2526
}
2627

2728
/** @test */
2829
public function transform_step()
2930
{
3031
$transformer = $this->createMock('Marquine\Etl\Transformers\Transformer');
31-
$transformer->expects($this->once())->method('options')->with(['option' => 'value']);
32+
$transformer->expects($this->once())->method('options')->with(['options']);
3233

3334
$container = $this->createMock('Marquine\Etl\Container');
3435
$container->expects($this->once())->method('step')->with('step_name', 'Marquine\Etl\Transformers\Transformer')->willReturn($transformer);
@@ -38,14 +39,15 @@ public function transform_step()
3839

3940
$etl = new Etl($container, $pipeline);
4041

41-
$this->assertInstanceOf(Etl::class, $etl->transform('step_name', ['option' => 'value']));
42+
$this->assertInstanceOf(Etl::class, $etl->transform('step_name', ['options']));
4243
}
4344

4445
/** @test */
4546
public function load_step()
4647
{
4748
$loader = $this->createMock('Marquine\Etl\Loaders\Loader');
48-
$loader->expects($this->once())->method('options')->with(['option' => 'value', 'output' => 'output']);
49+
$loader->expects($this->once())->method('output')->with('output')->willReturnSelf();
50+
$loader->expects($this->once())->method('options')->with(['options']);
4951

5052
$container = $this->createMock('Marquine\Etl\Container');
5153
$container->expects($this->once())->method('step')->with('step_name', 'Marquine\Etl\Loaders\Loader')->willReturn($loader);
@@ -55,7 +57,7 @@ public function load_step()
5557

5658
$etl = new Etl($container, $pipeline);
5759

58-
$this->assertInstanceOf(Etl::class, $etl->load('step_name', 'output', ['option' => 'value']));
60+
$this->assertInstanceOf(Etl::class, $etl->load('step_name', 'output', ['options']));
5961
}
6062

6163
/** @test */

0 commit comments

Comments
 (0)