本文整理匯總了PHP中Generator::sentence方法的典型用法代碼示例。如果您正苦於以下問題:PHP Generator::sentence方法的具體用法?PHP Generator::sentence怎麽用?PHP Generator::sentence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Generator
的用法示例。
在下文中一共展示了Generator::sentence方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test
public function test()
{
for ($i = 0; $i < 10; $i++) {
$sentence = $this->faker->sentence(30);
$encrypted = $this->encrypter->encryptToString($sentence);
$planString = $this->encrypter->decryptFromString($encrypted);
$this->assertEquals($sentence, $planString);
}
}
示例2: testPersonTestValidationDescription
public function testPersonTestValidationDescription()
{
$hostedPagesText = new HostedPagesText();
$hostedPagesText->setPaymentMethodType(HostedPagesText::PAYMENT_METHOD_TYPE_CC)->setFee(500)->setDescription('')->setLocale(Codes::LOCALE_EN);
$validation = new Validation();
$validation->getValidator($hostedPagesText);
$data = $validation->performValidation();
$this->assertValidationReturned('Upg\\Library\\Request\\Objects\\HostedPagesText', 'description', 'Description is required', $data, "Description is required did not trigger");
$hostedPagesText->setDescription($this->faker->sentence(90));
$validation->getValidator($hostedPagesText);
$data = $validation->performValidation();
$this->assertValidationReturned('Upg\\Library\\Request\\Objects\\HostedPagesText', 'description', 'Description must be no more than 255 characters long', $data, "Description must be no more than 255 characters long did not trigger");
}
示例3: testRefundValidationAmount
public function testRefundValidationAmount()
{
$request = new Refund($this->config);
$request->setOrderID(1)->setCaptureID(1)->setRefundDescription($this->faker->sentence(1));
$validation = new Validation();
$validation->getValidator($request);
$data = $validation->performValidation();
$this->assertValidationReturned('Upg\\Library\\Request\\Refund', 'amount', 'amount is required', $data, "amount is required failed to trigger");
}
示例4: testBasketItemValidationBasketItemText
public function testBasketItemValidationBasketItemText()
{
$basketItem = new BasketItem();
$basketItem->setBasketItemID('1')->setBasketItemCount(1)->setBasketItemAmount($this->getBasketItemAmount())->setBasketItemRiskClass(RiskClass::RISK_CLASS_DEFAULT);
$validation = new Validation();
$validation->getValidator($basketItem);
$data = $validation->performValidation();
/**
* Test required validation
*/
$this->assertValidationReturned('Upg\\Library\\Request\\Objects\\BasketItem', 'basketItemText', 'basketItemText is required', $data, "basketItemText is required did not trigger");
$basketItem->setBasketItemText($this->faker->sentence(255));
$validation->getValidator($basketItem);
$data = $validation->performValidation();
/**
* Test the length validation
*/
$this->assertValidationReturned('Upg\\Library\\Request\\Objects\\BasketItem', 'basketItemText', 'basketItemText must be no more than 500 characters', $data, "basketItemText must be no more than 500 characters did not trigger");
}
示例5: testExtendedInstantiation
/**
* Test if fixed values and extended options will be populated
* in the appriate places;
*/
public function testExtendedInstantiation()
{
$testMac = $this->faker->sentence(1);
$testValue = $this->faker->name;
$extendedVar = new \stdClass();
$extendedVar->name = $this->faker->name;
$extendedVar->userAgent = $this->faker->userAgent;
$testArray = array('url' => $this->faker->url, 'tld' => $this->faker->tld);
$successResponse = new SuccessResponse($this->config, array('mac' => $testMac, 'value' => $testValue, 'extendedVar' => $extendedVar, 'testArray' => $testArray));
/**
* Test method on config
*/
$this->assertEquals($this->config, $successResponse->getData('config'));
$this->assertEquals($this->config, $successResponse->getConfig());
/**
* Test method on mac
*/
$this->assertEquals($testMac, $successResponse->getData('mac'));
$this->assertEquals($testMac, $successResponse->getMac());
/**
* Test method on extended var
*/
$this->assertEquals($extendedVar, $successResponse->getData('extendedVar'));
$this->assertEquals($extendedVar, $successResponse->getExtendedVar());
/**
* ok now check if the that the extended data is in the responseData array
* @see \Upg\Library\Response::responseData
**/
$extendedData = $successResponse->getAllData(true);
$expectedExtendedData = array('value' => $testValue, 'extendedVar' => $extendedVar, 'testArray' => $testArray);
$this->assertArrayHasKey('value', $extendedData);
$this->assertArrayHasKey('extendedVar', $extendedData);
$this->assertArrayHasKey('testArray', $extendedData);
$this->assertArrayNotHasKey('mac', $extendedData);
$this->assertArrayNotHasKey('config', $extendedData);
$this->assertArraySubset($expectedExtendedData, $extendedData, true);
}