Exemplo n.º 1
0
 /**
  * Implements custom generator behaviour
  *
  * @return void
  */
 protected function generateData()
 {
     $firstName = $this->testDataGenerator->firstName;
     $lastName = $this->testDataGenerator->lastName;
     $email = Choice::when($this->noEmail)->then(null)->otherwise($this->testDataGenerator->safeEmail);
     $userCategory = Choice::when($this->withUserCategory)->otherwise($this->testDataGenerator->randomNumber(1, 3));
     $createdAt = Choice::when($this->createdAtToday)->then($this->testDataGenerator->dateTimeBetween('today'))->otherwise($this->testDataGenerator->dateTimeBetween('-1 year', '-6 months'));
     $isActive = 'active' == $this->userStatus;
     $isDeleted = 'deleted' == $this->userStatus;
     $isBlocked = 'blocked' == $this->userStatus;
     $user = new User();
     $user->setFirstname($firstName);
     $user->setLastname($lastName);
     $user->setEmail($email);
     $user->setCreatedAt($createdAt);
     $user->setUserCategory($userCategory);
     $user->setIsActive($isActive);
     $user->setIsDeleted($isDeleted);
     $user->setIsBlocked($isBlocked);
     file_put_contents('/tmp/phpteda_user.csv', $user, FILE_APPEND);
 }
Exemplo n.º 2
0
 public function testReturningConditionValueWhenNotFalseOrOtherwiseValue()
 {
     $expectedValue = 'val1';
     $actualValue = Choice::when('val1')->otherwise('val2');
     $this->assertEquals($expectedValue, $actualValue);
 }