This commit is contained in:
Gabriel Caruso 2018-01-15 22:27:56 -02:00 коммит произвёл Vincent Jiang (LEI)
Родитель 1e239c4659
Коммит 092ea0bd90
12 изменённых файлов: 36 добавлений и 38 удалений

Просмотреть файл

@ -85,15 +85,15 @@ class AnonymousAccessFunctionalTest extends \PHPUnit\Framework\TestCase
$result = $proxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
$this->assertCount(0, $result->getBlobs());
$blob = TestResources::getInterestingName('b');
self::$blobRestProxy->createPageBlob($this->containerName, $blob, 512);
$result = $proxy->listBlobs($this->containerName);
$this->assertEquals(1, count($result->getBlobs()));
$this->assertCount(1, $result->getBlobs());
self::$blobRestProxy->deleteBlob($this->containerName, $blob);
$result = $proxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
$this->assertCount(0, $result->getBlobs());
}
/**
@ -122,16 +122,16 @@ class AnonymousAccessFunctionalTest extends \PHPUnit\Framework\TestCase
);
$result = self::$blobRestProxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
$this->assertCount(0, $result->getBlobs());
$blob = TestResources::getInterestingName('b');
self::$blobRestProxy->createBlockBlob($this->containerName, $blob, 'test content');
$result = self::$blobRestProxy->listBlobs($this->containerName);
$this->assertEquals(1, count($result->getBlobs()));
$this->assertCount(1, $result->getBlobs());
$content = stream_get_contents($proxy->getBlob($this->containerName, $blob)->getContentStream());
$this->assertEquals('test content', $content);
self::$blobRestProxy->deleteBlob($this->containerName, $blob);
$result = self::$blobRestProxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
$this->assertCount(0, $result->getBlobs());
//The following line will generate ServiceException with 404.
$result = $proxy->listBlobs($this->containerName);
}

Просмотреть файл

@ -154,10 +154,10 @@ class QueueServiceFunctionalOptionsTest extends \PHPUnit\Framework\TestCase
$options->setMetadata($metadata);
$options->setTimeout(-10);
$this->assertEquals($options->getMetadata(), $metadata, 'Set CreateQueueOptions->getMetadata');
$this->assertEquals(2, count($options->getMetadata()), 'Set CreateQueueOptions->getMetadata->size');
$this->assertCount(2, $options->getMetadata(), 'Set CreateQueueOptions->getMetadata->size');
$this->assertEquals(-10, $options->getTimeout(), 'Set CreateQueueOptions->getTimeout');
$options->addMetadata('aaa', 'bbb');
$this->assertEquals(3, count($options->getMetadata()), 'Set CreateQueueOptions->getMetadata->size');
$this->assertCount(3, $options->getMetadata(), 'Set CreateQueueOptions->getMetadata->size');
}
public function testCheckCreateMessageOptions()

Просмотреть файл

@ -168,8 +168,8 @@ class TableServiceFunctionalOptionsTest extends \PHPUnit\Framework\TestCase
$options->addSelectField('baz');
$this->assertNotNull($options->getSelectFields(), 'Add $options->getSelectFields');
$this->assertNotNull($options->getQuery()->getSelectFields(), 'Add $options->getQuery->getSelectFields');
$this->assertEquals(2, count($options->getSelectFields()), 'Add $options->getSelectFields->size');
$this->assertEquals(2, count($options->getQuery()->getSelectFields()), 'Add $options->getQuery->getSelectFields->size');
$this->assertCount(2, $options->getSelectFields(), 'Add $options->getSelectFields->size');
$this->assertCount(2, $options->getQuery()->getSelectFields(), 'Add $options->getQuery->getSelectFields->size');
$filter = Filter::applyConstant('foo', EdmType::STRING);
$options->setFilter($filter);
@ -194,7 +194,7 @@ class TableServiceFunctionalOptionsTest extends \PHPUnit\Framework\TestCase
$query->addSelectField('bar');
$query->addSelectField('baz');
$this->assertNotNull($query->getSelectFields(), 'Add Query->getSelectFields');
$this->assertEquals(2, count($query->getSelectFields()), 'Add Query->getSelectFields->size');
$this->assertCount(2, $query->getSelectFields(), 'Add Query->getSelectFields->size');
$filter = Filter::applyConstant('foo', EdmType::STRING);
$query->setFilter($filter);
@ -407,7 +407,7 @@ class TableServiceFunctionalOptionsTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($value, $entity->getPropertyValue($name), 'Default Entity->getPropertyValue(\'' . $name . '\')');
$this->assertEquals($edmType, $entity->getProperty($name)->getEdmType(), 'Default Entity->getProperty(\'' . $name . '\')->getEdmType');
$this->assertEquals($value, $entity->getProperty($name)->getValue(), 'Default Entity->getProperty(\'' . $name . '\')->getValue');
$this->assertTrue($property != $entity->getProperty($name), 'Default Entity->getProperty(\'' . $name . '\') changed');
$this->assertNotEquals($entity->getProperty($name), $property, 'Default Entity->getProperty(\'' . $name . '\') changed');
$entity->setProperties($properties);
$this->assertNotNull($entity->getProperties(), 'Default Entity->getProperties');

Просмотреть файл

@ -120,14 +120,14 @@ class ACLBaseTest extends \PHPUnit\Framework\TestCase
);
}
$this->assertEquals(5, count($acl->getSignedIdentifiers()));
$this->assertCount(5, $acl->getSignedIdentifiers());
//remove a non-exist signed identifier.
$acl->removeSignedIdentifier('random_signed_identifier');
$this->assertEquals(5, count($acl->getSignedIdentifiers()));
$this->assertCount(5, $acl->getSignedIdentifiers());
//remove an exist signed identifier.
$acl->removeSignedIdentifier('a');
$this->assertEquals(4, count($acl->getSignedIdentifiers()));
$this->assertCount(4, $acl->getSignedIdentifiers());
//add this signed identifier back.
$acl->addSignedIdentifier(
$sample[0]['Id'],
@ -135,7 +135,7 @@ class ACLBaseTest extends \PHPUnit\Framework\TestCase
$sample[0]['AccessPolicy']['Expiry'],
$sample[0]['AccessPolicy']['Permission']
);
$this->assertEquals(5, count($acl->getSignedIdentifiers()));
$this->assertCount(5, $acl->getSignedIdentifiers());
//add a signed identifier with existing ID.
$acl->addSignedIdentifier(
$sample[0]['Id'],
@ -143,7 +143,7 @@ class ACLBaseTest extends \PHPUnit\Framework\TestCase
$sample[0]['AccessPolicy']['Expiry'],
$sample[0]['AccessPolicy']['Permission']
);
$this->assertEquals(5, count($acl->getSignedIdentifiers()));
$this->assertCount(5, $acl->getSignedIdentifiers());
//add 6th signed identifier, expect error.
$acl->addSignedIdentifier(
$sample[5]['Id'],

Просмотреть файл

@ -98,9 +98,7 @@ class SharedKeyAuthSchemeTest extends \PHPUnit\Framework\TestCase
$actual = $mock->getAuthorizationHeader($headers, $url, $queryParams, $httpMethod);
$this->assertTrue(
substr($actual, 0, \strlen($expected)) == $expected
);
$this->assertEquals($expected, substr($actual, 0, \strlen($expected)));
}
public function testComputeCanonicalizedHeadersMock()

Просмотреть файл

@ -48,9 +48,9 @@ class HttpCallContextTest extends \PHPUnit\Framework\TestCase
$this->assertNull($context->getMethod());
$this->assertNull($context->getPath());
$this->assertNull($context->getUri());
$this->assertTrue(is_array($context->getHeaders()));
$this->assertTrue(is_array($context->getQueryParameters()));
$this->assertTrue(is_array($context->getStatusCodes()));
$this->assertInternalType('array', $context->getHeaders());
$this->assertInternalType('array', $context->getQueryParameters());
$this->assertInternalType('array', $context->getStatusCodes());
return $context;
}
@ -190,7 +190,7 @@ class HttpCallContextTest extends \PHPUnit\Framework\TestCase
$context->removeHeader($key);
// Assert
$this->assertFalse(array_key_exists($key, $context->getHeaders()));
$this->assertArrayNotHasKey($key, $context->getHeaders());
}
/**

Просмотреть файл

@ -112,7 +112,7 @@ class ServiceRestProxyTest extends \PHPUnit\Framework\TestCase
$actual = ServiceRestProxy::groupQueryValues($values);
// Assert
$this->assertTrue(empty($actual));
$this->assertEmpty($actual);
}
/**

Просмотреть файл

@ -259,22 +259,22 @@ class UtilitiesTest extends \PHPUnit\Framework\TestCase
public function testToBoolean()
{
$this->assertTrue(is_bool(Utilities::toBoolean('true')));
$this->assertInternalType('bool', Utilities::toBoolean('true'));
$this->assertEquals(true, Utilities::toBoolean('true'));
$this->assertTrue(is_bool(Utilities::toBoolean('false')));
$this->assertInternalType('bool', Utilities::toBoolean('false'));
$this->assertEquals(false, Utilities::toBoolean('false'));
$this->assertTrue(is_bool(Utilities::toBoolean(null)));
$this->assertInternalType('bool', Utilities::toBoolean(null));
$this->assertEquals(false, Utilities::toBoolean(null));
$this->assertTrue(is_bool(Utilities::toBoolean('true', true)));
$this->assertInternalType('bool', Utilities::toBoolean('true', true));
$this->assertEquals(true, Utilities::toBoolean('true', true));
$this->assertTrue(is_bool(Utilities::toBoolean('false', true)));
$this->assertInternalType('bool', Utilities::toBoolean('false', true));
$this->assertEquals(false, Utilities::toBoolean('false', true));
$this->assertTrue(is_null(Utilities::toBoolean(null, true)));
$this->assertNull(Utilities::toBoolean(null, true));
$this->assertEquals(null, Utilities::toBoolean(null, true));
}

Просмотреть файл

@ -54,7 +54,7 @@ class GetDirectoryPropertiesResultTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($expectedEtag, $directoryPropertiesResult->getETag());
$actualMeta = $directoryPropertiesResult->getMetadata();
foreach ($expectedMeta as $key => $value) {
$this->assertTrue(array_key_exists($key, $actualMeta));
$this->assertArrayHasKey($key, $actualMeta);
$this->assertEquals($value, $actualMeta[$key]);
}
}

Просмотреть файл

@ -57,7 +57,7 @@ class GetSharePropertiesResultTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($expectedQuota, $shareProperties->getQuota());
$actualMeta = $shareProperties->getMetadata();
foreach ($expectedMeta as $key => $value) {
$this->assertTrue(array_key_exists($key, $actualMeta));
$this->assertArrayHasKey($key, $actualMeta);
$this->assertEquals($value, $actualMeta[$key]);
}
}

Просмотреть файл

@ -71,8 +71,8 @@ class ListDirectoriesAndFilesResultTest extends \PHPUnit\Framework\TestCase
$actual = $actuals[$i];
$entries = $sample[Resources::QP_ENTRIES];
if (empty($entries)) {
$this->assertTrue(empty($actual->getDirectories()));
$this->assertTrue(empty($actual->getFiles()));
$this->assertEmpty($actual->getDirectories());
$this->assertEmpty($actual->getFiles());
} else {
if (array_key_exists(Resources::QP_DIRECTORY, $entries)) {
$this->assertEquals(
@ -84,7 +84,7 @@ class ListDirectoriesAndFilesResultTest extends \PHPUnit\Framework\TestCase
$this->assertStringStartsWith('testdirectory', $dir->getName());
}
} else {
$this->assertTrue(empty($actual->getDirectories()));
$this->assertEmpty($actual->getDirectories());
}
if (array_key_exists(Resources::QP_FILE, $entries)) {
$this->assertEquals(
@ -97,7 +97,7 @@ class ListDirectoriesAndFilesResultTest extends \PHPUnit\Framework\TestCase
$this->assertGreaterThanOrEqual(0, $file->getLength());
}
} else {
$this->assertTrue(empty($actual->getFiles()));
$this->assertEmpty($actual->getFiles());
}
}
$this->assertEquals('myaccount', $actual->getAccountName());

Просмотреть файл

@ -49,7 +49,7 @@ class ListQueuesResultTest extends \PHPUnit\Framework\TestCase
// Assert
$this->assertCount(0, $actual->getQueues());
$this->assertTrue(empty($sample['NextMarker']));
$this->assertEmpty($sample['NextMarker']);
}
public function testCreateWithOneEntry()