Skip to content

Commit

Permalink
fix compatibility with 2.5 (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkSide666 authored Apr 20, 2021
1 parent e13c2c2 commit 481411b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function tryLogin(string $email, string $password): bool
// first logout
$this->logout();

$user = $this->user->newInstance();
$user = new $this->user($this->user->persistence);

$user->tryLoadBy($this->fieldLogin, $email);
if ($user->loaded()) {
Expand Down
4 changes: 2 additions & 2 deletions tests/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public function testDb()

// test traversal
$this->assertSame(2, count((clone $u)->load(2)->ref('AccessRules')->export()));
$this->assertSame(1, count((clone $u)->load(2)->ref('role_id')->export()));
$this->assertSame(2, (clone $u)->load(2)->ref('role_id')->getId());
$this->assertSame(2, count((clone $r)->load(2)->ref('AccessRules')->export()));
$this->assertSame(1, count((clone $r)->load(2)->ref('Users')->export()));
$this->assertSame(1, count((clone $a)->load(2)->ref('role_id')->export()));
$this->assertSame(2, (clone $a)->load(2)->ref('role_id')->getId());
}

public function testAuth($cacheEnabled = true)
Expand Down
4 changes: 3 additions & 1 deletion tests/Feature/SignupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ public function testBasic()

$this->assertTrue($m->hasUserAction('register_new_user'));

// as result it makes model loaded (as entity) with new user record
$m->executeUserAction(
'register_new_user',
['name' => 'New user', 'email' => 'test', 'password' => 'testpass']
);
$this->assertSame(1, count((clone $m)->addCondition('email', 'test')->export()));

$this->assertSame(1, count((new $m($m->persistence))->addCondition('email', 'test')->export()));
}
}

0 comments on commit 481411b

Please sign in to comment.