예제 #1
0
 /**
  * @test
  * @group iterator-employee-setter
  * @group iterator
  **/
 public function セッターのテスト()
 {
     $name = 'John';
     $age = 28;
     $job = 'Engineer';
     $this->employee->setName($name);
     $this->employee->setAge($age);
     $this->employee->setJob($job);
     $this->assertEquals($name, $this->employee->getName());
     $this->assertEquals($age, $this->employee->getAge());
     $this->assertEquals($job, $this->employee->getJob());
 }
 /**
  * @test
  * @group iterator-execute
  * @group iterator
  */
 public function 正常な処理()
 {
     $employees = new Employees();
     $user1 = new Employee();
     $user1->setName('Smith');
     $user1->setAge(32);
     $user1->setJob('CLEAK');
     $employees->add($user1);
     $user2 = new Employee();
     $user2->setName('Alen');
     $user2->setAge(26);
     $user2->setJob('SALESMAN');
     $employees->add($user2);
     $user3 = new Employee();
     $user3->setName('Martin');
     $user3->setAge(50);
     $user3->setJob('SALESMAN');
     $employees->add($user3);
     $user4 = new Employee();
     $user4->setName('Clark');
     $user4->setAge(45);
     $user4->setJob('MANAGER');
     $employees->add($user4);
     $user5 = new Employee();
     $user5->setName('King');
     $user5->setAge(45);
     $user5->setJob('PRESIDENT');
     $employees->add($user5);
     $iterator = $employees->getIterator();
     $salesmans = new SalesmanIterator($iterator);
     $list = file_get_contents(ROOT . '/data/Iterator/EmployeeList.html');
     $this->assertEquals($list, $this->_renderList($iterator));
     $list = file_get_contents(ROOT . '/data/Iterator/SalesmanList.html');
     $this->assertEquals($list, $this->_renderList($salesmans));
 }