Skip to content

Commit

Permalink
Fix EventsTest
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Jun 9, 2020
1 parent 95089fb commit cefe239
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions test/selenium/Database/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ protected function setUp(): void
{
parent::setUp();
$this->dbQuery(
'CREATE TABLE `test_table` ('
'USE `' . $this->database_name . '`;'
. 'CREATE TABLE `test_table` ('
. ' `id` int(11) NOT NULL AUTO_INCREMENT,'
. ' `val` int(11) NOT NULL,'
. ' PRIMARY KEY (`id`)'
. ')'
);
$this->dbQuery(
'INSERT INTO `test_table` (val) VALUES (2);'
);
$this->dbQuery(
'SET GLOBAL event_scheduler="ON"'
. ');'
. 'INSERT INTO `test_table` (val) VALUES (2);'
. 'SET GLOBAL event_scheduler="ON";'
);
$this->login();
$this->navigateDatabase($this->database_name);
Expand Down Expand Up @@ -137,18 +134,25 @@ public function testAddEvent()
)
);

$result = $this->dbQuery(
$this->dbQuery(
"SHOW EVENTS WHERE Db='" . $this->database_name
. "' AND Name='test_event'"
. "' AND Name='test_event'",
function () {
//TODO: improve the condition
$this->assertTrue($this->isElementPresent('className', 'table_results'));
}
);
$this->assertEquals(1, $result->num_rows);

sleep(2);
$result = $this->dbQuery(
'SELECT val FROM `' . $this->database_name . '`.`test_table`'
$this->dbQuery(
'SELECT val FROM `' . $this->database_name . '`.`test_table`',
function () {
//TODO: improve the condition
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertEquals($this->database_name, $this->getCellByTableClass('table_results', 1, 1));
//$this->assertGreaterThan(2, $row['val']);
}
);
$row = $result->fetch_assoc();
$this->assertGreaterThan(2, $row['val']);
}

/**
Expand Down

0 comments on commit cefe239

Please sign in to comment.