This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$faker = \Faker\Factory::create(); | |
$populator = new \Faker\ORM\Propel\Populator($faker); | |
$populator->addEntity('Author', 10000); | |
$populator->addEntity('Book', 100000); | |
$populator->addEntity('Review', 1000000); | |
$insertedPKs = $populator->execute(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$faker = \Faker\Factory::create(); | |
$populator = new \Faker\ORM\Propel\Populator($faker); | |
$populator->addEntity('Author', 100); | |
$insertedPKs = $populator->execute(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$faker = \Faker\Factory::create(); | |
$insertedPKs = array(); | |
for ($i=0; $i < 100; $i++) { | |
$author = new Author(); | |
$author->setFirstName($faker->firstName); | |
$author->setLastName($faker->lastName); | |
$author->setDateOfBirth($faker->date); | |
$author->setEmail($faker->email); | |
$author->save(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pdo = new PDO('mysql:host=hostname;dbname=defaultDbName', 'username', 'p@55w0rd'); | |
$sql = 'INSERT INTO author (first_name, last_name, date_of_birth, email) VALUES (?, ?, ?, ?)'; | |
$stmt = $pdo->prepare($sql); | |
$faker = \Faker\Factory::create(); | |
$insertedPKs = array(); | |
for ($i=0; $i < 100; $i++) { | |
$stmt->bindValue(1, $faker->firstName, PDO::PARAM_STR); | |
$stmt->bindValue(2, $faker->lastName, PDO::PARAM_STR); | |
$stmt->bindValue(1, $faker->date, PDO::PARAM_STR); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once '/path/to/Faker/src/Factory.php'; | |
$faker = Faker\Factory::create(); // $faker is a Faker\Generator instance | |
echo $faker->name; | |
// 'Lucy Cechtelar'; | |
echo $faker->address; | |
// "426 Jordy Lodge | |
// Cartwrightshire, SC 88120-6700" | |
echo $faker->lorem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tests=array(); | |
foreach (new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__,0|\RecursiveDirectoryIterator::SKIP_DOTS)), '/\.php$/') as $file) { | |
if (strpos((string) $file, '.svn')) { | |
continue; | |
} | |
$tests[] = realpath((string) $file); | |
} | |
foreach ($tests as $file) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Propel way | |
$books = BookQuery::create()->find(); | |
$xmlBooks = $books->toXml(); | |
// Doctrine way | |
// $this is a symfony controller having access to the DIC | |
$em = $this->get('doctrine.orm.entity_manager'); | |
$books = $em->createQuery('select b from \Acme\DemoBundle\Entity\Book b')->getResult(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/phpunit3/PlainPHPUnit3ResultFormatter.php b/phpunit3/PlainPHPUnit3ResultFormatter.php | |
index f2997aa..a671670 100644 | |
--- a/phpunit3/PlainPHPUnit3ResultFormatter.php | |
+++ b/phpunit3/PlainPHPUnit3ResultFormatter.php | |
@@ -52,19 +52,13 @@ class PlainPHPUnit3ResultFormatter extends PHPUnit3ResultFormatter | |
function endTestSuite(PHPUnit_Framework_TestSuite $suite) | |
{ | |
- $sb = "Testsuite: " . $suite->getName() . "\n"; | |
- $sb.= "Tests run: " . $this->getRunCount(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AggregateColumnBehavior extends Behavior | |
{ | |
// default parameters value | |
protected $parameters = array( | |
'name' =>; null, | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre><code><database name="my_connection_name" defaultIdMethod="native" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation="http://www.propelorm.org/xsd/1.5/database.xsd" > | |
</code></pre> |