本文整理汇总了PHP中Faker\Factory::text方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::text方法的具体用法?PHP Factory::text怎么用?PHP Factory::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Faker\Factory
的用法示例。
在下文中一共展示了Factory::text方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeleteResource
public function testDeleteResource()
{
$expectedObject = ['dummyText' => $this->faker->text(), 'dummyNumber' => $this->faker->randomDigit()];
$transport = $this->getMockBuilder('\\JsonApi\\Transports\\Guzzle')->setMethods(['delete'])->getMock();
$transport->expects($this->once())->method('delete')->willReturn(json_encode($expectedObject));
$client = new Client();
$client->setTransport($transport);
$client->deleteResource($this->faker->url());
}
示例2: testDependency
public function testDependency()
{
$expectedDependency = $this->faker->text();
$di = Di::getInstance();
$dependencyDirectory = sys_get_temp_dir();
$di->setDependenciesDirectory($dependencyDirectory);
$tempname = tempnam($dependencyDirectory, '');
$dependency = basename($tempname);
$phpFile = $tempname . '.php';
if (is_file($phpFile)) {
unlink($phpFile);
}
file_put_contents($phpFile, "<?php\nreturn '" . addslashes($expectedDependency) . "';\n");
$this->assertEquals($expectedDependency, $di->{$dependency});
unlink($phpFile);
unlink($tempname);
}
示例3: testLoad
public function testLoad()
{
$expectedVarValue = $this->faker->text();
$configDirectory = sys_get_temp_dir();
$loader = new Loader();
$loader->setNamespace($configDirectory);
$tempname = tempnam($configDirectory, '');
$config = basename($tempname);
$phpFile = $tempname . '.php';
if (is_file($phpFile)) {
unlink($phpFile);
}
file_put_contents($phpFile, "<?php\n\$dummy='" . addslashes($expectedVarValue) . "';\n");
$this->assertEquals($expectedVarValue, $loader->loadByKey($loader->getConfigurationKey($config))->dummy);
unlink($phpFile);
unlink($tempname);
}
示例4: makeNode
/**
* Generates a node
* @param string $nodeId
* @param string $startDate
* @param string $endDate
* @param string $oparg
* @return string Node tag with random content
*/
protected function makeNode($nodeId, $startDate, $endDate, $oparg = '')
{
$detail = $this->tag('detail', \htmlentities($this->faker->text(150)));
$start = strtotime($startDate);
$end = strtotime($endDate);
// $middleDate = date('Y-m-d H:i:s', $this->faker->numberBetween($start, $end));
$attr = ['pk' => $nodeId, 'label' => 'Primary', 'start' => $startDate, 'end' => $endDate, 'layer' => $this->layers[0]['name'], 'oparg' => $oparg];
$first = $this->tag('node', $detail, $attr);
// // use the second layer
// $attrTwo = array_merge($attr, [
// 'pk' => "{$nodeId}-s",
// 'label' => ' ', // We'll empty this
// 'start' => $middleDate,
// 'end' => $endDate,
// 'layer' => $this->layers[1]['name'],
// ]);
// $second = $this->tag('node', $this->tag('detail', ''), $attrTwo);
return "\n\t\t{$first}";
}
示例5: testGetLoaderException
public function testGetLoaderException()
{
$this->setExpectedException('\\ConfigurationFactory\\Exception', 'loader not setted');
$factory = new ConfigurationFactory();
$factory->get($this->faker->text());
}