Skip to content

Commit

Permalink
Merge branch 'release-3.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bugalot committed Aug 10, 2018
2 parents 75798bb + c5c7515 commit f955859
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 280 deletions.
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'label' => 'Test-taker core extension',
'description' => 'TAO TestTaker extension',
'license' => 'GPL-2.0',
'version' => '3.10.0',
'version' => '3.10.2',
'author' => 'Open Assessment Technologies, CRP Henri Tudor',
'requires' => array(
'tao' => '>=19.11.0',
Expand Down
2 changes: 1 addition & 1 deletion scripts/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ public function update($initialVersion)

$this->setVersion('3.7.0');
}
$this->skip('3.7.0', '3.10.0');
$this->skip('3.7.0', '3.10.2');
}
}
114 changes: 55 additions & 59 deletions test/RestTestTakerTest.php → test/integration/RestTestTakerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
namespace oat\taoTestTaker\test;

namespace oat\taoTestTaker\test\integration;

include_once dirname(__FILE__) . '/../../includes/raw_start.php';

use oat\tao\model\TaoOntology;
use oat\generis\model\GenerisRdf;
use oat\tao\test\RestTestCase;
use \core_kernel_users_Service;
use oat\tao\test\integration\RestTestCase;

/**
* connects as a client agent on the rest controller
Expand All @@ -31,9 +34,6 @@
*/
class RestTestTakerTest extends RestTestCase
{

private $genLogin;

private function checkPropertyValues($propertyValues, $property, $valueType = "literal", $value)
{
if (is_array($propertyValues)) {
Expand All @@ -59,13 +59,11 @@ public function serviceProvider()
);
}

private function getUrl() {
return $this->host.'taoTestTaker/Api';
private function getUrl()
{
return $this->host . 'taoTestTaker/Api';
}

/**
*
*/
public function testCreateTestTaker()
{
// create a new test taker without aprameters, should return a 400
Expand Down Expand Up @@ -157,54 +155,52 @@ public function testUpdateTestTaker($uriSubject)
}

$this->checkPropertyValues($data["data"]["properties"], GenerisRdf::PROPERTY_USER_LASTNAME, "literal", 'patrick');
}

public function testCreateTestTaker2()
{
$returnedData = $this->curl($this->getUrl(), CURLOPT_POST, "data", array(
'login: 2_dummy_login',
'password: dummy'
));
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);
return $data["data"]["uriResource"];
}

/**
* remove all test takers
*
* @depends testCreateTestTaker
* @depends testCreateTestTaker2
*/
public function testDeleteTestTakers($uriSubject, $uri2Subject)
{
// get all test takers

$returnedData = $this->curl($this->getUrl());
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);
$this->assertGreaterThanOrEqual(2, count($data["data"]));
$beforeDelete = count($data["data"]);


$returnedData = $this->curl($this->getUrl(), "DELETE", CURLINFO_HTTP_CODE, array(
'uri: ' . $uriSubject
));
$this->assertEquals($returnedData, 200);

$returnedData = $this->curl($this->getUrl(), "DELETE", "data", array(
'uri: ' . $uri2Subject
));
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);


//check the removal
$returnedData = $this->curl($this->getUrl());
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);
$this->assertCount($beforeDelete - 2 , $data["data"]);

}
}

public function testCreateTestTaker2()
{
$returnedData = $this->curl($this->getUrl(), CURLOPT_POST, "data", array(
'login: 2_dummy_login',
'password: dummy'
));
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);
return $data["data"]["uriResource"];
}

/**
* remove all test takers
*
* @depends testCreateTestTaker
* @depends testCreateTestTaker2
*/
public function testDeleteTestTakers($uriSubject, $uri2Subject)
{
// get all test takers

$returnedData = $this->curl($this->getUrl());
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);
$this->assertGreaterThanOrEqual(2, count($data["data"]));
$beforeDelete = count($data["data"]);


$returnedData = $this->curl($this->getUrl(), "DELETE", CURLINFO_HTTP_CODE, array(
'uri: ' . $uriSubject
));
$this->assertEquals($returnedData, 200);

$returnedData = $this->curl($this->getUrl(), "DELETE", "data", array(
'uri: ' . $uri2Subject
));
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);


//check the removal
$returnedData = $this->curl($this->getUrl());
$data = json_decode($returnedData, true);
$this->assertEquals($data["success"], true);
$this->assertCount($beforeDelete - 2, $data["data"]);
}
}
Loading

0 comments on commit f955859

Please sign in to comment.