本文整理汇总了PHP中PHPUnit_Framework_Assert::assertInternalType方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertInternalType方法的具体用法?PHP PHPUnit_Framework_Assert::assertInternalType怎么用?PHP PHPUnit_Framework_Assert::assertInternalType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::assertInternalType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get($url, $options = [], $caller = __METHOD__)
{
PHPUnit_Framework_Assert::assertInternalType('string', $url);
PHPUnit_Framework_Assert::assertInternalType('array', $options);
PHPUnit_Framework_Assert::assertInternalType('string', $caller);
return self::$response;
}
示例2: it_can_return_its_id
/**
* @test
*/
public function it_can_return_its_id()
{
$conn = $this->factory->createConnection('localhost');
$channel = $this->factory->createChannel($conn);
Assert::assertInternalType('integer', $channel->getChannelId());
Assert::assertGreaterThan(0, $channel->getChannelId());
}
示例3: decodeByProperty
/**
* @param string $property
* @param string $format
*
* @return mixed[]
*/
private function decodeByProperty($property, $format)
{
return array_map(function ($entry) use($property) {
\PHPUnit_Framework_Assert::assertInternalType('array', $entry);
\PHPUnit_Framework_Assert::assertArrayHasKey($property, $entry);
return $entry[$property];
}, $this->decode($format));
}
示例4: toBeOfType
/**
* Expect that a variable is of a given type.
*
* @param string $expected
* @param string $message
*
* @return Expect
*/
public function toBeOfType($expected, $message = '')
{
Assert::assertInternalType($expected, $this->value, $message);
return $this;
}
示例5: assertResourceCollection
/**
* Assert that the data member is a collection, and return it as a resource collection tester.
*
* @param string|null $message
* @return ResourcesTester
*/
public function assertResourceCollection($message = null)
{
$message = $message ?: 'Document does not have a resource collection in its data member.';
$collection = $this->getData();
PHPUnit::assertInternalType('array', $collection, $message);
return new ResourcesTester($collection);
}
示例6: thePropertyIsA
/**
* @Then the :name property is a(n) :type
*/
public function thePropertyIsA($name, $type)
{
$data = $this->getScopedResponse();
PHPUnit::assertInternalType($type, $data->{$name});
}
示例7: assertJsonValueEquals
/**
* Asserts if the value retrieved with the expression equals the expected value.
*
* Example:
*
* static::assertJsonValueEquals(33, 'foo.bar[0]', $json);
*
* @param mixed $expected Expected value
* @param string $expression Expression to retrieve the result
* (e.g. locations[?state == 'WA'].name | sort(@))
* @param array|object $json JSON Content
*/
public static function assertJsonValueEquals($expected, $expression, $json)
{
$result = \JmesPath\Env::search($expression, $json);
\PHPUnit_Framework_Assert::assertEquals($expected, $result);
\PHPUnit_Framework_Assert::assertInternalType(gettype($expected), $result);
}
示例8: seePropertyIs
/**
* Checks that the property is a passed type.
* Either 'int', 'bool', 'string', 'array', 'float', 'null', 'resource', 'scalar' can be passed for simple types.
* Otherwise the parameter must be a class and the property must be an instance of that class.
*
* Bear in mind that testing non-public properties is not a good practice.
* Use it only if you have no other way to test it.
*
* @param $object
* @param $property
* @param $type
* @deprecated
*/
public function seePropertyIs($object, $property, $type)
{
$current = $this->retrieveProperty($object, $property);
if (in_array($type, array('int', 'bool', 'string', 'array', 'float', 'null', 'resource', 'scalar'))) {
\PHPUnit_Framework_Assert::assertInternalType($type, $current);
return;
}
\PHPUnit_Framework_Assert::assertInstanceOf($type, $current);
}
示例9: assertInternalType
/**
* @param $type
* @param $actual
* @param $description
*/
protected function assertInternalType($type, $actual, $description)
{
\PHPUnit_Framework_Assert::assertInternalType($type, $actual, $description);
}
示例10: testGetAllChannels
public function testGetAllChannels()
{
// Creating response with specific url
$this->_clientMockAdapter->addResponseBy(Response::STATUS_OK, 'api/channel', json_encode($this->channelsData));
$repo = new ChannelRepository($this->_client);
$metadata = array();
$channels = $repo->getAllRecords(null, $metadata);
// Checking response (validating specific url was matched)
\PHPUnit_Framework_Assert::assertTrue($this->_client->getResponse()->isOK());
// Check return type
\PHPUnit_Framework_Assert::assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $channels);
// Check return count
\PHPUnit_Framework_Assert::assertEquals(count($this->channelsData['objects']), count($channels));
if ($channels) {
// Check return item type
\PHPUnit_Framework_Assert::assertInstanceOf(self::MODEL_NAMESPACE . 'Channel', $channels[0]);
}
// Validating fields data
$this->validatesObjectsData($this->channelsData['objects'], $channels);
}
示例11: fetchExpenseListsForMyAccount
/**
* @return \stdClass[]
*/
public function fetchExpenseListsForMyAccount()
{
$this->client->request('GET', '/expense_list/');
$response = $this->client->getResponse();
PHPUnit_Framework_Assert::assertEquals(Response::HTTP_OK, $response->getStatusCode());
PHPUnit_Framework_Assert::assertJson($response->getContent());
$responseData = json_decode($response->getContent());
PHPUnit_Framework_Assert::assertInternalType('array', $responseData);
return $responseData;
}
示例12: isInternalType
public function isInternalType($type)
{
Assert::assertInternalType($type, $this->actual, $this->description);
return $this;
}
示例13: testJsonDataResponse
public function testJsonDataResponse()
{
$path = '/test/path';
$headers = array('h1' => 'a', 'h2' => 'b');
$parameters = array('p1' => 'c', 'p2' => 'd');
$method = AbstractClient::METHOD_GET;
$responseData = array('status' => 'ok', 'data' => 123, 'message' => 'This is a test');
$responseContent = json_encode($responseData);
$mockAdapter = new MockAdapter();
// Adds mock basic OK response
$mockAdapter->addResponseBy(Response::STATUS_OK, '', $responseContent);
// Add mock adapter
$this->_client->setAdapter($mockAdapter);
// Send request
$data = $this->_client->get($path, $parameters, $headers);
// Gets response object
$response = $this->_client->getResponse();
// Content is being returned correctly
\PHPUnit_Framework_Assert::assertJson($response->getRawContent());
\PHPUnit_Framework_Assert::assertJsonStringEqualsJsonString($responseContent, $response->getRawContent());
// Content is being parsed correctly (json)
\PHPUnit_Framework_Assert::assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_OBJECT, $data);
// Check data parsed
foreach ($responseData as $key => $value) {
\PHPUnit_Framework_Assert::assertObjectHasAttribute($key, $data);
\PHPUnit_Framework_Assert::assertEquals($value, $data->{$key});
}
\PHPUnit_Framework_Assert::assertTrue($response->isOK());
}
示例14: internalType
public function internalType($type)
{
a::assertInternalType($type, $this->actual, $this->description);
}
示例15: thatICreateANewProductNumber
/**
* @Given that I create a new product number
*/
public function thatICreateANewProductNumber()
{
$this->new_product_number = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 16);
PHPUnit::assertInternalType('string', $this->new_product_number);
}