本文整理汇总了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);
}