Fixed phpunit Test class

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-06-13 07:15:42 +02:00
parent 9a32592aca
commit 49d0f0c499
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
11 changed files with 81 additions and 70 deletions

View File

@ -24,6 +24,7 @@
use Behat\Behat\Hook\Scope\AfterScenarioScope;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use GuzzleHttp\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@ -78,9 +79,9 @@ trait AppConfiguration {
$this->sendingTo('get', '/cloud/apps?filter=enabled');
$this->theHTTPStatusCodeShouldBe('200');
if ($enabled) {
PHPUnit_Framework_Assert::assertContains('testing', $this->response->getBody()->getContents());
Assert::assertContains('testing', $this->response->getBody()->getContents());
} else {
PHPUnit_Framework_Assert::assertNotContains('testing', $this->response->getBody()->getContents());
Assert::assertNotContains('testing', $this->response->getBody()->getContents());
}
}

View File

@ -32,6 +32,7 @@
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ClientException;
use PHPUnit\Framework\Assert;
use Psr\Http\Message\ResponseInterface;
require __DIR__ . '/../../vendor/autoload.php';
@ -238,7 +239,7 @@ trait BasicStructure {
* @param int $statusCode
*/
public function theOCSStatusCodeShouldBe($statusCode) {
PHPUnit_Framework_Assert::assertEquals($statusCode, $this->getOCSResponse($this->response));
Assert::assertEquals($statusCode, $this->getOCSResponse($this->response));
}
/**
@ -246,7 +247,7 @@ trait BasicStructure {
* @param int $statusCode
*/
public function theHTTPStatusCodeShouldBe($statusCode) {
PHPUnit_Framework_Assert::assertEquals($statusCode, $this->response->getStatusCode());
Assert::assertEquals($statusCode, $this->response->getStatusCode());
}
/**
@ -254,7 +255,7 @@ trait BasicStructure {
* @param string $contentType
*/
public function theContentTypeShouldbe($contentType) {
PHPUnit_Framework_Assert::assertEquals($contentType, $this->response->getHeader('Content-Type')[0]);
Assert::assertEquals($contentType, $this->response->getHeader('Content-Type')[0]);
}
/**

View File

@ -28,6 +28,7 @@ use Behat\Behat\Hook\Scope\AfterScenarioScope;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@ -53,7 +54,7 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext {
$answeredValue = $answeredValue->{$path_to_element[$i]};
}
$answeredValue = (string)$answeredValue;
PHPUnit_Framework_Assert::assertEquals(
Assert::assertEquals(
$row['value']==="EMPTY" ? '' : $row['value'],
$answeredValue,
"Failed field " . $row['capability'] . " " . $row['path_to_element']

View File

@ -23,6 +23,7 @@
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@ -63,7 +64,7 @@ trait Download {
public function theDownloadedZipFileIsAZip32File() {
// assertNotContains is not used to prevent the whole file from being
// printed in case of error.
PHPUnit_Framework_Assert::assertTrue(
Assert::assertTrue(
strpos($this->downloadedFile, "\x50\x4B\x06\x06") === false,
"File contains the zip64 end of central dir signature"
);
@ -75,7 +76,7 @@ trait Download {
public function theDownloadedZipFileIsAZip64File() {
// assertNotContains is not used to prevent the whole file from being
// printed in case of error.
PHPUnit_Framework_Assert::assertTrue(
Assert::assertTrue(
strpos($this->downloadedFile, "\x50\x4B\x06\x06") !== false,
"File does not contain the zip64 end of central dir signature"
);
@ -95,7 +96,7 @@ trait Download {
// assertRegExp is not used to prevent the whole file from being printed
// in case of error and to be able to get the extra field length.
PHPUnit_Framework_Assert::assertEquals(
Assert::assertEquals(
1, preg_match($fileHeaderRegExp, $this->downloadedFile, $matches),
"Local header for file did not appear once in zip file"
);
@ -115,7 +116,7 @@ trait Download {
// assertRegExp is not used to prevent the whole file from being printed
// in case of error.
PHPUnit_Framework_Assert::assertEquals(
Assert::assertEquals(
1, preg_match($fileHeaderAndContentRegExp, $this->downloadedFile),
"Local header and contents for file did not appear once in zip file"
);
@ -135,7 +136,7 @@ trait Download {
// assertRegExp is not used to prevent the whole file from being printed
// in case of error.
PHPUnit_Framework_Assert::assertEquals(
Assert::assertEquals(
1, preg_match($folderHeaderRegExp, $this->downloadedFile),
"Local header for folder did not appear once in zip file"
);

View File

@ -23,6 +23,7 @@
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use PHPUnit\Framework\Assert;
class LDAPContext implements Context {
use BasicStructure;
@ -36,7 +37,7 @@ class LDAPContext implements Context {
*/
public function theResponseShouldContainATag($arg1) {
$configID = simplexml_load_string($this->response->getBody())->data[0]->$arg1;
PHPUnit_Framework_Assert::assertInstanceOf(SimpleXMLElement::class, $configID[0]);
Assert::assertInstanceOf(SimpleXMLElement::class, $configID[0]);
}
/**
@ -61,7 +62,7 @@ class LDAPContext implements Context {
*/
public function theResponseShouldContainATagWithValue($tagName, $expectedValue) {
$data = simplexml_load_string($this->response->getBody())->data[0]->$tagName;
PHPUnit_Framework_Assert::assertEquals($expectedValue, $data[0]);
Assert::assertEquals($expectedValue, $data[0]);
}
/**

View File

@ -29,6 +29,7 @@
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@ -61,7 +62,7 @@ trait Provisioning {
$this->currentUser = $previous_user;
}
$this->userExists($user);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -73,7 +74,7 @@ trait Provisioning {
$this->userExists($user);
} catch (\GuzzleHttp\Exception\ClientException $ex) {
$this->response = $ex->getResponse();
PHPUnit_Framework_Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
return;
}
$previous_user = $this->currentUser;
@ -84,7 +85,7 @@ trait Provisioning {
$this->userExists($user);
} catch (\GuzzleHttp\Exception\ClientException $ex) {
$this->response = $ex->getResponse();
PHPUnit_Framework_Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
}
}
@ -141,9 +142,9 @@ trait Provisioning {
foreach ($settings->getRows() as $setting) {
$value = json_decode(json_encode(simplexml_load_string($response->getBody())->data->{$setting[0]}), 1);
if (isset($value[0])) {
PHPUnit_Framework_Assert::assertEquals($setting[1], $value[0], "", 0.0, 10, true);
Assert::assertEquals($setting[1], $value[0], "", 0.0, 10, true);
} else {
PHPUnit_Framework_Assert::assertEquals('', $setting[1]);
Assert::assertEquals('', $setting[1]);
}
}
}
@ -211,8 +212,8 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
$respondedArray = $this->getArrayOfGroupsResponded($this->response);
sort($respondedArray);
PHPUnit_Framework_Assert::assertContains($group, $respondedArray);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertContains($group, $respondedArray);
Assert::assertEquals(200, $this->response->getStatusCode());
}
public function userBelongsToGroup($user, $group) {
@ -272,8 +273,8 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
$groups = array($group);
$respondedArray = $this->getArrayOfGroupsResponded($this->response);
PHPUnit_Framework_Assert::assertNotEquals($groups, $respondedArray, "", 0.0, 10, true);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertNotEquals($groups, $respondedArray, "", 0.0, 10, true);
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -428,7 +429,7 @@ trait Provisioning {
$this->currentUser = $previous_user;
}
$this->groupExists($group);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -440,7 +441,7 @@ trait Provisioning {
$this->groupExists($group);
} catch (\GuzzleHttp\Exception\ClientException $ex) {
$this->response = $ex->getResponse();
PHPUnit_Framework_Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
return;
}
$previous_user = $this->currentUser;
@ -451,7 +452,7 @@ trait Provisioning {
$this->groupExists($group);
} catch (\GuzzleHttp\Exception\ClientException $ex) {
$this->response = $ex->getResponse();
PHPUnit_Framework_Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
Assert::assertEquals(404, $ex->getResponse()->getStatusCode());
}
}
@ -474,8 +475,8 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
$respondedArray = $this->getArrayOfSubadminsResponded($this->response);
sort($respondedArray);
PHPUnit_Framework_Assert::assertContains($user, $respondedArray);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertContains($user, $respondedArray);
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -497,7 +498,7 @@ trait Provisioning {
'OCS-APIREQUEST' => 'true',
];
$this->response = $client->post($fullUrl, $options);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -519,8 +520,8 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
$respondedArray = $this->getArrayOfSubadminsResponded($this->response);
sort($respondedArray);
PHPUnit_Framework_Assert::assertNotContains($user, $respondedArray);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertNotContains($user, $respondedArray);
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -532,7 +533,7 @@ trait Provisioning {
$users = $usersList->getRows();
$usersSimplified = $this->simplifyArray($users);
$respondedArray = $this->getArrayOfUsersResponded($this->response);
PHPUnit_Framework_Assert::assertEquals($usersSimplified, $respondedArray, "", 0.0, 10, true);
Assert::assertEquals($usersSimplified, $respondedArray, "", 0.0, 10, true);
}
}
@ -546,7 +547,7 @@ trait Provisioning {
$groups = $groupsList->getRows();
$groupsSimplified = $this->simplifyArray($groups);
$respondedArray = $this->getArrayOfGroupsResponded($this->response);
PHPUnit_Framework_Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true);
Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true);
}
}
@ -560,7 +561,7 @@ trait Provisioning {
$groups = $groupsList->getRows();
$groupsSimplified = $this->simplifyArray($groups);
$respondedArray = $this->getArrayOfSubadminsResponded($this->response);
PHPUnit_Framework_Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true);
Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true);
}
}
@ -574,7 +575,7 @@ trait Provisioning {
$apps = $appList->getRows();
$appsSimplified = $this->simplifyArray($apps);
$respondedArray = $this->getArrayOfAppsResponded($this->response);
PHPUnit_Framework_Assert::assertEquals($appsSimplified, $respondedArray, "", 0.0, 10, true);
Assert::assertEquals($appsSimplified, $respondedArray, "", 0.0, 10, true);
}
}
@ -653,8 +654,8 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
$respondedArray = $this->getArrayOfAppsResponded($this->response);
PHPUnit_Framework_Assert::assertContains($app, $respondedArray);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertContains($app, $respondedArray);
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -674,8 +675,8 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
$respondedArray = $this->getArrayOfAppsResponded($this->response);
PHPUnit_Framework_Assert::assertContains($app, $respondedArray);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertContains($app, $respondedArray);
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -695,7 +696,7 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
// false in xml is empty
PHPUnit_Framework_Assert::assertTrue(empty(simplexml_load_string($this->response->getBody())->data[0]->enabled));
Assert::assertTrue(empty(simplexml_load_string($this->response->getBody())->data[0]->enabled));
}
/**
@ -715,7 +716,7 @@ trait Provisioning {
$this->response = $client->get($fullUrl, $options);
// boolean to string is integer
PHPUnit_Framework_Assert::assertEquals("1", simplexml_load_string($this->response->getBody())->data[0]->enabled);
Assert::assertEquals("1", simplexml_load_string($this->response->getBody())->data[0]->enabled);
}
/**

View File

@ -20,6 +20,7 @@
*/
use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@ -79,7 +80,7 @@ class RemoteContext implements Context {
$version = \OC::$server->getConfig()->getSystemValue('version', '0.0.0.0');
}
PHPUnit_Framework_Assert::assertEquals($version, $this->remoteInstance->getVersion());
Assert::assertEquals($version, $this->remoteInstance->getVersion());
}
/**
@ -87,7 +88,7 @@ class RemoteContext implements Context {
* @param string $protocol
*/
public function theRemoteProtocolShouldBe($protocol) {
PHPUnit_Framework_Assert::assertEquals($protocol, $this->remoteInstance->getProtocol());
Assert::assertEquals($protocol, $this->remoteInstance->getProtocol());
}
/**
@ -117,7 +118,7 @@ class RemoteContext implements Context {
* @param string $user
*/
public function remoteUserId($user) {
PHPUnit_Framework_Assert::assertEquals($user, $this->userResult->getUserId());
Assert::assertEquals($user, $this->userResult->getUserId());
}
/**
@ -125,7 +126,7 @@ class RemoteContext implements Context {
* @param string $class
*/
public function lastError($class) {
PHPUnit_Framework_Assert::assertEquals($class, get_class($this->lastException));
Assert::assertEquals($class, get_class($this->lastException));
}
/**
@ -142,6 +143,6 @@ class RemoteContext implements Context {
$current = isset($current[$part]) ? $current[$part] : null;
}
}
PHPUnit_Framework_Assert::assertEquals($value, $current);
Assert::assertEquals($value, $current);
}
}

View File

@ -23,6 +23,7 @@
*/
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use PHPUnit\Framework\Assert;
use Psr\Http\Message\ResponseInterface;
require __DIR__ . '/../../vendor/autoload.php';
@ -64,10 +65,10 @@ class ShareesContext implements Context, SnippetAcceptingContext {
if ($isEmpty !== 'is empty') {
$sharees = $shareesList->getRows();
$respondedArray = $this->getArrayOfShareesResponded($this->response, $shareeType);
PHPUnit_Framework_Assert::assertEquals($sharees, $respondedArray);
Assert::assertEquals($sharees, $respondedArray);
} else {
$respondedArray = $this->getArrayOfShareesResponded($this->response, $shareeType);
PHPUnit_Framework_Assert::assertEmpty($respondedArray);
Assert::assertEmpty($respondedArray);
}
}

View File

@ -27,6 +27,7 @@
*/
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@ -132,7 +133,7 @@ trait Sharing {
$client = new Client();
$this->response = $client->get($url, $options);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertEquals(200, $this->response->getStatusCode());
$buf = '';
$body = $this->response->getBody();
@ -144,7 +145,7 @@ trait Sharing {
if ($mimeType !== null) {
$finfo = new finfo;
PHPUnit_Framework_Assert::assertEquals($mimeType, $finfo->buffer($buf, FILEINFO_MIME_TYPE));
Assert::assertEquals($mimeType, $finfo->buffer($buf, FILEINFO_MIME_TYPE));
}
}
@ -164,7 +165,7 @@ trait Sharing {
$date = date('Y-m-d', strtotime("+3 days"));
$options['form_params'] = ['expireDate' => $date];
$this->response = $this->response = $client->request("PUT", $fullUrl, $options);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -201,7 +202,7 @@ trait Sharing {
$this->response = $ex->getResponse();
}
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
Assert::assertEquals(200, $this->response->getStatusCode());
}
public function createShare($user,
@ -303,7 +304,7 @@ trait Sharing {
* @param string $filename
*/
public function checkSharedFileInResponse($filename){
PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse('file_target', "/$filename"));
Assert::assertEquals(True, $this->isFieldInResponse('file_target', "/$filename"));
}
/**
@ -312,7 +313,7 @@ trait Sharing {
* @param string $filename
*/
public function checkSharedFileNotInResponse($filename){
PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('file_target', "/$filename"));
Assert::assertEquals(False, $this->isFieldInResponse('file_target', "/$filename"));
}
/**
@ -321,7 +322,7 @@ trait Sharing {
* @param string $user
*/
public function checkSharedUserInResponse($user){
PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse('share_with', "$user"));
Assert::assertEquals(True, $this->isFieldInResponse('share_with', "$user"));
}
/**
@ -330,7 +331,7 @@ trait Sharing {
* @param string $user
*/
public function checkSharedUserNotInResponse($user){
PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('share_with', "$user"));
Assert::assertEquals(False, $this->isFieldInResponse('share_with', "$user"));
}
public function isUserOrGroupInSharedData($userOrGroup, $permissions = null){
@ -369,7 +370,7 @@ trait Sharing {
$this->createShare($user1, $filepath, 0, $user2, null, null, $permissions);
}
$this->response = $client->get($fullUrl, $options);
PHPUnit_Framework_Assert::assertEquals(True, $this->isUserOrGroupInSharedData($user2, $permissions));
Assert::assertEquals(True, $this->isUserOrGroupInSharedData($user2, $permissions));
}
/**
@ -398,7 +399,7 @@ trait Sharing {
$this->createShare($user, $filepath, 1, $group, null, null, $permissions);
}
$this->response = $client->get($fullUrl, $options);
PHPUnit_Framework_Assert::assertEquals(True, $this->isUserOrGroupInSharedData($group, $permissions));
Assert::assertEquals(True, $this->isUserOrGroupInSharedData($group, $permissions));
}
/**
@ -425,7 +426,7 @@ trait Sharing {
public function checkingLastShareIDIsIncluded(){
$share_id = $this->lastShareData->data[0]->id;
if (!$this->isFieldInResponse('id', $share_id)){
PHPUnit_Framework_Assert::fail("Share id $share_id not found in response");
Assert::fail("Share id $share_id not found in response");
}
}
@ -435,7 +436,7 @@ trait Sharing {
public function checkingLastShareIDIsNotIncluded(){
$share_id = $this->lastShareData->data[0]->id;
if ($this->isFieldInResponse('id', $share_id)){
PHPUnit_Framework_Assert::fail("Share id $share_id has been found in response");
Assert::fail("Share id $share_id has been found in response");
}
}
@ -457,7 +458,7 @@ trait Sharing {
$value = str_replace("LOCAL", substr($this->localBaseUrl, 0, -4), $value);
}
if (!$this->isFieldInResponse($field, $value)){
PHPUnit_Framework_Assert::fail("$field" . " doesn't have value " . "$value");
Assert::fail("$field" . " doesn't have value " . "$value");
}
}
}

View File

@ -22,6 +22,7 @@
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@ -71,7 +72,7 @@ trait Trashbin {
$firstEntry = $this->findFirstTrashedEntry($user, trim($sections[0], '/'));
PHPUnit_Framework_Assert::assertNotNull($firstEntry);
Assert::assertNotNull($firstEntry);
// query was on the main element ?
if (count($sections) === 1) {
@ -97,7 +98,7 @@ trait Trashbin {
}
}
PHPUnit_Framework_Assert::assertTrue($found);
Assert::assertTrue($found);
}
/**

View File

@ -31,6 +31,7 @@
use GuzzleHttp\Client as GClient;
use GuzzleHttp\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
use Sabre\DAV\Client as SClient;
use Sabre\DAV\Xml\Property\ResourceType;
@ -111,7 +112,7 @@ trait WebDav {
$fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user);
$headers['Destination'] = $fullUrl . $fileDestination;
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
PHPUnit_Framework_Assert::assertEquals(201, $this->response->getStatusCode());
Assert::assertEquals(201, $this->response->getStatusCode());
}
/**
@ -199,7 +200,7 @@ trait WebDav {
* @param string $content
*/
public function downloadedContentShouldBe($content) {
PHPUnit_Framework_Assert::assertEquals($content, (string)$this->response->getBody());
Assert::assertEquals($content, (string)$this->response->getBody());
}
/**
@ -457,7 +458,7 @@ trait WebDav {
foreach ($elementsSimplified as $expectedElement) {
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
if (!array_key_exists($webdavPath, $elementList)) {
PHPUnit_Framework_Assert::fail("$webdavPath" . " is not in propfind answer");
Assert::fail("$webdavPath" . " is not in propfind answer");
}
}
}
@ -488,7 +489,7 @@ trait WebDav {
public function userAddsAFileTo($user, $bytes, $destination) {
$filename = "filespecificSize.txt";
$this->createFileSpecificSize($filename, $bytes);
PHPUnit_Framework_Assert::assertEquals(1, file_exists("work/$filename"));
Assert::assertEquals(1, file_exists("work/$filename"));
$this->userUploadsAFileTo($user, "work/$filename", $destination);
$this->removeFile("work/", $filename);
$expectedElements = new \Behat\Gherkin\Node\TableNode([["$destination"]]);
@ -675,7 +676,7 @@ trait WebDav {
public function checkIfETAGHasNotChanged($path, $user) {
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
PHPUnit_Framework_Assert::assertEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
Assert::assertEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
/**
@ -684,7 +685,7 @@ trait WebDav {
public function checkIfETAGHasChanged($path, $user) {
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
/**
@ -728,7 +729,7 @@ trait WebDav {
foreach ($elementsSimplified as $expectedElement) {
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
if (!array_key_exists($webdavPath, $elementList)) {
PHPUnit_Framework_Assert::fail("$webdavPath" . " is not in report answer");
Assert::fail("$webdavPath" . " is not in report answer");
}
}
}
@ -780,6 +781,6 @@ trait WebDav {
*/
public function userChecksFileIdForPath($user, $path) {
$currentFileID = $this->getFileIdForPath($user, $path);
PHPUnit_Framework_Assert::assertEquals($currentFileID, $this->storedFileID);
Assert::assertEquals($currentFileID, $this->storedFileID);
}
}