Skip to content

Commit

Permalink
Fix user table on wordpress 4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana committed Jul 25, 2024
1 parent 9fbb4ed commit 96857dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
class AutomatedLoginEventsTestSuite extends AppsecTestCase
{
protected $users_table = 'wp55_users';
protected function ddSetUp()
{
parent::ddSetUp();
Expand All @@ -27,7 +28,7 @@ public function testUserLoginSuccessEvent()
$name = 'some name';
//Password is test
$this->connection()->exec(
'INSERT INTO wp55_users VALUES ('.$id.',"test","$P$BDzpK1XXL9P2cYWggPMUbN87GQSiI80","test","'.$email.'","","2020-10-22 16:31:15","",0,"'.$name.'")'
'INSERT INTO '.$this->users_table.' VALUES ('.$id.',"test","$P$BDzpK1XXL9P2cYWggPMUbN87GQSiI80","test","'.$email.'","","2020-10-22 16:31:15","",0,"'.$name.'")'
);

$spec = PostSpec::create('request', '/wp-login.php', [
Expand Down Expand Up @@ -70,7 +71,7 @@ public function testUserLoginFailureEventWhenUserDoesExists()
$name = 'some name';
//Password is test
$this->connection()->exec(
'INSERT INTO wp55_users VALUES ('.$id.',"test","$P$BDzpK1XXL9P2cYWggPMUbN87GQSiI80","test","'.$email.'","","2020-10-22 16:31:15","",0,"'.$name.'")'
'INSERT INTO '.$this->users_table.' VALUES ('.$id.',"test","$P$BDzpK1XXL9P2cYWggPMUbN87GQSiI80","test","'.$email.'","","2020-10-22 16:31:15","",0,"'.$name.'")'
);

$spec = PostSpec::create('request', '/wp-login.php', [
Expand Down Expand Up @@ -98,7 +99,7 @@ public function testUserSignUp()
], "user_login=$username&user_email=$email&wp-submit=Register&redirect_to=")
);

$users = $this->connection()->query("SELECT * FROM wp55_users where user_email='".$email."'")->fetchAll();
$users = $this->connection()->query("SELECT * FROM ".$this->users_table." where user_email='".$email."'")->fetchAll();

$this->assertEquals(1, count($users));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
class AutomatedLoginEventsTest extends AutomatedLoginEventsTestSuite
{
protected $users_table = 'wp_users';

protected static function getAppIndexScript()
{
return __DIR__ . '/../../../Frameworks/WordPress/Version_4_8/index.php';
Expand Down

0 comments on commit 96857dd

Please sign in to comment.