Skip to content

Commit

Permalink
Small fixes to D6, still errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cliftonc committed Mar 28, 2011
1 parent 8713f9b commit f952347
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 41 deletions.
2 changes: 1 addition & 1 deletion features.d6/example.feature
Expand Up @@ -12,7 +12,7 @@ Feature: I can see my content

Scenario: Can view content
Given that I am an anonymous user
When I look at the "My Example Content" node
When I look at the "node/1" node
Then I should see "Not this content" in the content

@blog
Expand Down
49 changes: 11 additions & 38 deletions features.d6/steps/example_steps.php
Expand Up @@ -10,62 +10,35 @@
});

$steps->Then('/^I should see "([^"]*)" in the menu$/', function($world, $title) {
$found = false;
foreach ($world->menu as $menuitem) {
if($menuitem['link']['title'] == $title) $found = true;
}
if(!$found) {
throw new \Behat\Behat\Exception\Exception();
}
if(!bdd_drupal_is_in_menu($title,$world->menu)) {
throw new \Behat\Behat\Exception\Exception();
}
});

$steps->When('/^I look at the "([^"]*)" node$/', function($world, $node) {
$world->node = menu_get_object('node',1,'node/1');
$world->node = bdd_drupal_get_path_content($node);
});

$steps->Then('/^I should see "([^"]*)" in the content$/', function($world, $contents) {
if($world->node->body != $contents) {
throw new \Behat\Behat\Exception\Exception();
}
$steps->Then('/^I should see "([^"]*)" in the content$/', function($world, $text) {
if(bdd_drupal_contains($world->node,$text) == false) {
throw new \Behat\Behat\Exception\Exception();
}
});

$steps->Given('/^that I am a logged in user$/', function($world) {
bdd_drupal_set_user(BDD_DRUPAL_ADMIN);
});

$steps->When('/^I look at my blog$/', function($world) {

$module = menu_get_item('blog/1');

// print_r($module);
// Wrap into helper
$module_func = $module['page_callback'];
$module_arg = $module['page_arguments'][0];

print_r("HERE");

require_once $module['file'];


print_r("HERE");


$result = $module_func($module_arg);

print_r("HERE");

// $world->blog = $result;
$world->blog = bdd_drupal_get_path_content('blog/1');

});

$steps->Then('/^I should see "([^"]*)" the content$/', function($world, $text) {

if(is_string($world->blog)) {
if(strpos($world->blog,$text) === false){
if(bdd_drupal_contains($world->blog,$text) == false){
throw new \Behat\Behat\Exception\Exception();
}
} else {
throw new \Behat\Behat\Exception\Exception();
}
}

});
6 changes: 4 additions & 2 deletions features.d6/support/drupal-6.helpers.php
Expand Up @@ -56,7 +56,9 @@ function bdd_drupal_get_node_at_path($path) {
function bdd_drupal_get_path_content($path) {

$returnValue = "";

$item = menu_get_item($path);

$callback = $item['page_callback'];

if($callback) {
Expand All @@ -70,8 +72,8 @@ function bdd_drupal_get_path_content($path) {
}

// Call callback
$result = $callback($callback_arg); // Check D7 code
print("RESULT: " . $result);
$result = $callback($callback_arg); // Check D7 code

$returnValue = $result;

}
Expand Down

0 comments on commit f952347

Please sign in to comment.