Esempio n. 1
0
 public function testParametersAreReplaced()
 {
     $res = $this->loadData([self::USER => ['user1' => ['username' => '<{user_1_username}>_alice']]], ['parameters' => ['user_1_username' => 'user']]);
     $this->assertCount(1, $res);
     $user1 = $this->loader->getReference('user1');
     $this->assertInstanceOf(self::USER, $user1);
     $this->assertEquals('user_alice', $user1->username);
 }
Esempio n. 2
0
 public function testNullVariable()
 {
     $loader = new Loader('en_US', [new FakerProvider()]);
     $loader->load([self::USER => ['user' => ['username' => '0%? adrien', 'fullname' => '<noop($username)>']]]);
     $this->assertNull($loader->getReference('user')->username);
     $this->assertNull($loader->getReference('user')->fullname);
 }
Esempio n. 3
0
 public function testCurrentInConstructor()
 {
     $res = $this->loadData(array(self::USER => array('user1' => array('__construct' => array('alice', '*****@*****.**')), 'user2' => array('__construct' => array('bob', '*****@*****.**'))), self::CONTACT => array('contact{1..2}' => array('__construct' => array('@user<current()>')))));
     $this->assertSame($this->loader->getReference('user1'), $this->loader->getReference('contact1')->getUser());
     $this->assertSame($this->loader->getReference('user2'), $this->loader->getReference('contact2')->getUser());
 }