Skip to content

Commit

Permalink
LIMS-1238: Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Williams committed Dec 22, 2024
1 parent 02ee1c8 commit 886d752
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/tests/Model/Services/UserDataSingleInvocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,28 +239,28 @@ public function testGetUsersCountWithValidSortByPidPersonIdIsManagerCurrentUserI
public function testGetUsersWithValidSortBypIDPersonIdIsManagerCurrentUserIdPjid(): void
{
$res = $this->userData->getUsers(false, true, 's', 3, 'LOGIN', 5, 5, 6, true, 7, null, 10);
$this->assertEquals("SELECT CONCAT(p.personid, '-', php.projectid) as ppid, p.personid, p.givenname, p.familyname, CONCAT(p.givenname, ' ', p.familyname) as fullname, p.login, p.emailaddress, p.phonenumber, l.name as labname, l.address, l.city, l.postcode, l.country FROM Person p LEFT OUTER JOIN Laboratory l ON l.laboratoryid = p.laboratoryid INNER JOIN Project_has_Person php ON p.personid = php.personid WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND php.projectid=10 GROUP BY p.personid ORDER BY p.login ASC LIMIT 30,15", $this->db->getLastQuery());
$this->assertEquals("SELECT CONCAT(p.personid, '-', php.projectid) as ppid, p.personid, p.givenname, p.familyname, CONCAT(p.givenname, ' ', p.familyname) as fullname, p.login, p.emailaddress, p.phonenumber, l.name as labname, l.address, l.city, l.postcode, l.country FROM Person p LEFT OUTER JOIN Laboratory l ON l.laboratoryid = p.laboratoryid LEFT OUTER JOIN ProposalHasPerson prhp ON prhp.personid = p.personid LEFT OUTER JOIN LabContact lc ON lc.personid = p.personid INNER JOIN Project_has_Person php ON p.personid = php.personid WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND php.projectid=10 GROUP BY p.personid ORDER BY p.login ASC LIMIT 30,15", $this->db->getLastQuery());
$this->assertEmpty($res);
}

public function testGetUsersCountWithValidSortByPidPersonIdIsManagerCurrentUserIdPjId(): void
{
$res = $this->userData->getUsers(true, true, 's', 3, 'LOGIN', 5, 5, 6, true, 7, null, 10);
$this->assertEquals("SELECT count(distinct p.personid) as tot FROM Person p INNER JOIN Project_has_Person php ON p.personid = php.personid WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND php.projectid=10", $this->db->getLastQuery());
$this->assertEquals("SELECT count(distinct p.personid) as tot FROM Person p LEFT OUTER JOIN ProposalHasPerson prhp ON prhp.personid = p.personid LEFT OUTER JOIN LabContact lc ON lc.personid = p.personid INNER JOIN Project_has_Person php ON p.personid = php.personid WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND php.projectid=10", $this->db->getLastQuery());
$this->assertEmpty($res);
}

public function testGetUsersWithValidSortBypIDPersonIdIsManagerCurrentUserIdVisitname(): void
{
$res = $this->userData->getUsers(false, true, 's', 3, 'LOGIN', 5, 5, 6, true, 7, null, null, 'visit1');
$this->assertEquals("SELECT count(ses.sessionid) as visits, DATE_FORMAT(max(ses.startdate), '%d-%m-%Y') as last, shp.remote, shp.role, p.personid, p.givenname, p.familyname, CONCAT(p.givenname, ' ', p.familyname) as fullname, p.login, p.emailaddress, p.phonenumber, l.name as labname, l.address, l.city, l.postcode, l.country FROM Person p LEFT OUTER JOIN Laboratory l ON l.laboratoryid = p.laboratoryid INNER JOIN Session_has_Person shp ON shp.personid = p.personid INNER JOIN BLSession s ON shp.sessionid = s.sessionid INNER JOIN Proposal pr ON pr.proposalid = s.proposalid LEFT OUTER JOIN Session_has_Person shp2 ON p.personid = shp2.personid LEFT OUTER JOIN BLSession ses ON ses.sessionid = shp2.sessionid AND ses.startdate < s.startdate WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND shp.remote IS NOT NULL AND CONCAT(pr.proposalcode, pr.proposalnumber, '-', s.visit_number) LIKE 'visit1' GROUP BY p.personid, p.givenname, p.familyname, p.login ORDER BY p.login ASC LIMIT 30,15", $this->db->getLastQuery());
$res = $this->userData->getUsers(false, true, 's', 3, 'LOGIN', 5, 5, 6, true, 7, null, null, 'mx12345-1');
$this->assertEquals("SELECT count(ses.sessionid) as visits, DATE_FORMAT(max(ses.startdate), '%d-%m-%Y') as last, shp.remote, shp.role, p.personid, p.givenname, p.familyname, CONCAT(p.givenname, ' ', p.familyname) as fullname, p.login, p.emailaddress, p.phonenumber, l.name as labname, l.address, l.city, l.postcode, l.country FROM Person p LEFT OUTER JOIN Laboratory l ON l.laboratoryid = p.laboratoryid INNER JOIN Session_has_Person shp ON shp.personid = p.personid INNER JOIN BLSession s ON shp.sessionid = s.sessionid INNER JOIN Proposal pr ON pr.proposalid = s.proposalid LEFT OUTER JOIN Session_has_Person shp2 ON p.personid = shp2.personid LEFT OUTER JOIN BLSession ses ON ses.sessionid = shp2.sessionid AND ses.startdate < s.startdate WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND shp.remote IS NOT NULL AND pr.proposalcode = 'mx' AND pr.proposalnumber = '12345' AND s.visit_number = '1' GROUP BY p.personid, p.givenname, p.familyname, p.login ORDER BY p.login ASC LIMIT 30,15", $this->db->getLastQuery());
$this->assertEmpty($res);
}

public function testGetUsersCountWithValidSortByPidPersonIdIsManagerCurrentUserIdVisitname(): void
{
$res = $this->userData->getUsers(true, true, 's', 3, 'LOGIN', 5, 5, 6, true, 7, null, null, 'visit1');
$this->assertEquals("SELECT count(distinct p.personid) as tot FROM Person p INNER JOIN Session_has_Person shp ON shp.personid = p.personid INNER JOIN BLSession s ON shp.sessionid = s.sessionid INNER JOIN Proposal pr ON pr.proposalid = s.proposalid LEFT OUTER JOIN Session_has_Person shp2 ON p.personid = shp2.personid LEFT OUTER JOIN BLSession ses ON ses.sessionid = shp2.sessionid AND ses.startdate < s.startdate WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND shp.remote IS NOT NULL AND CONCAT(pr.proposalcode, pr.proposalnumber, '-', s.visit_number) LIKE 'visit1'", $this->db->getLastQuery());
$res = $this->userData->getUsers(true, true, 's', 3, 'LOGIN', 5, 5, 6, true, 7, null, null, 'mx12345-1');
$this->assertEquals("SELECT count(distinct p.personid) as tot FROM Person p INNER JOIN Session_has_Person shp ON shp.personid = p.personid INNER JOIN BLSession s ON shp.sessionid = s.sessionid INNER JOIN Proposal pr ON pr.proposalid = s.proposalid LEFT OUTER JOIN Session_has_Person shp2 ON p.personid = shp2.personid LEFT OUTER JOIN BLSession ses ON ses.sessionid = shp2.sessionid AND ses.startdate < s.startdate WHERE 1=1 AND (prhp.proposalid=5 OR lc.proposalid=5 OR p.personid=7) AND p.personid=6 AND (p.familyname LIKE CONCAT('%','s','%') OR p.givenname LIKE CONCAT('%','s','%') OR p.login LIKE CONCAT('%','s','%')) AND shp.remote IS NOT NULL AND pr.proposalcode = 'mx' AND pr.proposalnumber = '12345' AND s.visit_number = '1'", $this->db->getLastQuery());
$this->assertEmpty($res);
}

Expand Down

0 comments on commit 886d752

Please sign in to comment.