Skip to content

Commit

Permalink
test(functional) fix assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Jun 19, 2020
1 parent f78c7db commit d275146
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions tests/functional/WPDbUserCest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Codeception\Example;
use tad\WPBrowser\Generators\User;

class WPDbUserCest
Expand Down Expand Up @@ -100,22 +101,29 @@ public function it_should_set_the_user_level_to_0_by_default(FunctionalTester $I
$I->seeUserMetaInDatabase($criteria);
}

public function it_should_set_bool_meta_to_true_false_by_default(FunctionaLTester $I) {
public function boolMetaKeys()
{
return [
'rich_editing' => [ 'key' => 'rich_editing', 'value' => 'true' ],
'syntax_highlighting' => [ 'key' => 'syntax_highlighting', 'value' => 'true' ],
'comment_shortcuts' => [ 'key' => 'comment_shortcuts', 'value' => 'false' ],
'show_admin_bar_front' => [ 'key' => 'show_admin_bar_front', 'value' => 'true' ],
];
}

/**
* @dataProvider boolMetaKeys
*/
public function it_should_set_bool_meta_to_true_false_by_default(FunctionaLTester $I, Example $data)
{
$I->haveUserInDatabase('Luca');
$userId = $I->grabUserIdFromDatabase('Luca');
$criteria = [
'user_id' => $userId,
'meta_key' => $I->grabPrefixedTableNameFor('show_admin_bar_front'),
'meta_value' => 'true',
'meta_key' => $data['key'],
'meta_value' => $data['value'],
];
$I->seeUserMetaInDatabase($criteria);

$criteria['meta_key'] = $I->grabPrefixedTableNameFor('rich_editing');
$I->seeUserMetaInDatabase($criteria);

$criteria['meta_key'] = $I->grabPrefixedTableNameFor('comment_shortcuts');
$criteria['meta_value'] = 'false';
$I->seeUserMetaInDatabase($criteria);
}

/**
Expand Down

0 comments on commit d275146

Please sign in to comment.