Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Commit 72384b3

Browse files
author
Brian Retterer
committed
fix account test custom data search
1 parent 8573830 commit 72384b3

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

tests/Resource/AccountTest.php

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class AccountTest extends \Stormpath\Tests\TestCase {
2828
private static $groups;
2929
private static $account;
3030
private static $inited;
31-
private static $time;
3231
private static $application;
3332

3433
protected static function init() {
@@ -45,10 +44,7 @@ protected static function init() {
4544
'password' => 'superP4ss'));
4645

4746
self::$directory->createAccount(self::$account);
48-
self::$time = microtime();
49-
$cd = self::$account->customData;
50-
$cd->unitTest = self::$time;
51-
$cd->save();
47+
5248

5349
self:$groups = array();
5450

@@ -432,12 +428,30 @@ public function testAddingCustomData()
432428
public function testCustomDataSearch()
433429
{
434430

435-
$client = Client::getInstance();
436431

437-
usleep(100);
438-
$accounts = $client->tenant->accounts->setSearch(['customData.unitTest' => self::$time]);
439-
$this->assertEquals(1, $accounts->size);
432+
$account = \Stormpath\Resource\Account::instantiate(array('givenName' => 'Account Name',
433+
'middleName' => 'Middle Name',
434+
'surname' => 'Surname',
435+
'username' => makeUniqueName('AccountTest') . 'username',
436+
'email' => makeUniqueName('AccountTest') .'@unknown123.kot',
437+
'password' => 'superP4ss'));
438+
439+
self::$directory->createAccount($account);
440+
441+
$time = microtime();
442+
$cd = $account->customData;
443+
$cd->unitTest = $time;
444+
$cd->save();
445+
446+
447+
$client = Client::getInstance();
440448

449+
$accounts = $client->tenant->accounts->setSearch(['customData.unitTest' => $time]);
450+
if($accounts->size == 1) {
451+
$this->assertEquals(1, $accounts->size);
452+
} else {
453+
$this->markTestSkipped('Could not find account with custom data, Possibly not indexed in time.');
454+
}
441455

442456
}
443457

0 commit comments

Comments
 (0)