-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathScenario.php
More file actions
55 lines (47 loc) · 1.19 KB
/
Scenario.php
File metadata and controls
55 lines (47 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace Rhubarb\Stem\Custard;
use Symfony\Component\Console\Output\OutputInterface;
class Scenario
{
/**
* @var callable $seedScenario
*/
private $seedScenario;
/**
* @var ScenarioDescription $scenarioDescription
*/
private $scenarioDescription;
/**
* @var string
*/
private $name;
/**
* Scenario constructor.
* @param string $name of the scenario
* @param callable $seedScenario callback, a ScenarioDescription will be given as the first parameter
*
*/
public function __construct(string $name, callable $seedScenario)
{
$this->seedScenario = $seedScenario;
$this->scenarioDescription = new ScenarioDescription();
$this->name = $name;
}
/**
* @param OutputInterface $output
* Run the data seeder and describe what happened to $output
*/
public function run(OutputInterface $output)
{
$seedScenario = $this->seedScenario;
$seedScenario($this->scenarioDescription);
$this->scenarioDescription->describe($output);
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
}