File tree Expand file tree Collapse file tree 5 files changed +141
-1
lines changed
Expand file tree Collapse file tree 5 files changed +141
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ default:
2222 raUrl : ' https://ra.dev.openconext.local'
2323 - ApiFeatureContext :
2424 apiUrl : ' https://middleware.dev.openconext.local'
25+ - ReplayContext : ~
2526 - Behat\MinkExtension\Context\MinkContext
2627
2728 extensions :
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class FeatureContext implements Context
4545 */
4646 private $ institutionConfiguration ;
4747
48- private static function execCommand (string $ command ): void
48+ public static function execCommand (string $ command ): void
4949 {
5050 $ output = [];
5151 $ returnCode = -1 ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Behat \Behat \Context \Context ;
4+ use Behat \Behat \Hook \Scope \BeforeScenarioScope ;
5+ use Behat \MinkExtension \Context \MinkContext ;
6+
7+ class ReplayContext implements Context
8+ {
9+ /**
10+ * @var \Behat\MinkExtension\Context\MinkContext
11+ */
12+ private $ minkContext ;
13+
14+ /**
15+ * @BeforeScenario
16+ */
17+ public function gatherContexts (BeforeScenarioScope $ scope )
18+ {
19+ $ environment = $ scope ->getEnvironment ();
20+
21+ $ this ->minkContext = $ environment ->getContext (MinkContext::class);
22+ }
23+
24+ /**
25+ * @Given a replay is performed
26+ */
27+ public function replay ()
28+ {
29+ // Generate test databases
30+ echo "Preparing test schemas \n" ;
31+ FeatureContext::execCommand ('docker exec -t stepup-middleware-1 bin/console doctrine:schema:drop --em=middleware --env=smoketest --force ' );
32+ FeatureContext::execCommand ('docker exec -t stepup-middleware-1 bin/console doctrine:schema:drop --em=gateway --env=smoketest --force ' );
33+ FeatureContext::execCommand ('docker exec -t stepup-middleware-1 bin/console doctrine:schema:create --em=middleware --env=smoketest ' );
34+ FeatureContext::execCommand ('docker exec -t stepup-middleware-1 bin/console doctrine:schema:create --em=gateway --env=smoketest ' );
35+
36+ // Import the events.sql into middleware
37+ echo "Add events to test database \n" ;
38+ FeatureContext::execCommand ("mysql -uroot -psecret middleware_test -h mariadb < ./fixtures/eventstream.sql " );
39+
40+ // Perform an event replay
41+ echo "Replaying event stream \n" ;
42+ FeatureContext::execCommand ("docker exec -t stepup-middleware-1 bin/console middleware:event:replay --env=smoketest_event_replay --no-interaction -vvv " );
43+ }
44+ }
Original file line number Diff line number Diff line change 1+ Feature : A replay is performed on Middleware
2+ In order to replay an event stream
3+ On the command line
4+ I expect the last event to be reflected in the data set
5+
6+ Scenario : After a replay is performed I would expect the last event reflected in the data set
7+ Given a replay is performed
8+ Given I authenticate with user "ra" and password "secret"
9+ And I request "GET /identity?institution=institution-b.example.com&NameID=urn:collab:person:institution-b.example.com:joe-b5"
10+ Then the api response status code should be 200
11+ And the "items" property should contain 1 items
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments