Skip to content

Commit ca88ade

Browse files
author
Codeliner
committed
Add add_voyage.feature and clear db before feature
1 parent 48d0718 commit ca88ade

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

features/add_cargo.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Feature: Add a Cargo
2-
In order to ship a Cargo
2+
In order to handle a Cargo
33
As a booking manager
44
I need to be able to add a new Cargo
55

features/add_voyage.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Feature: Add a Voyage
2+
In order to manage a Voyage
3+
As a booking manager
4+
I need to be able to add a new Voyage
5+
6+
@javascript
7+
Scenario: Add a new Voyage
8+
Given I am on "application/voyage/add"
9+
When I fill in "voyage_number" with "SHIP123"
10+
And I fill in "name" with "HongkongToHamburg"
11+
And I fill in "capacity" with "50"
12+
And I click the submit button
13+
Then the url should match "application/voyage/index"

features/bootstrap/FeatureContext.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,15 @@ static public function iniializeZendFramework()
5151
}
5252

5353
/**
54-
* @BeforeScenario
54+
* @BeforeFeature
5555
*/
56-
public function clearDatabase()
56+
public static function clearDatabase()
5757
{
58-
//to stuff here
59-
}
60-
61-
/**
62-
* @return ServiceManager
63-
*/
64-
private function getServiceManager()
65-
{
66-
return self::$zendApp->getServiceManager();
58+
$em = self::$zendApp->getServiceManager()->get('doctrine.entitymanager.orm_default');
59+
$q = $em->createQuery('delete from Application\Domain\Model\Cargo\Cargo');
60+
$q->execute();
61+
$q = $em->createQuery('delete from Application\Domain\Model\Voyage\Voyage');
62+
$q->execute();
6763
}
6864

6965
/**

0 commit comments

Comments
 (0)