저는 PhpUnit을 처음 사용했기 때문에 테스트를 작성하는 모범 사례에 의구심이 생깁니다.PhpUnit을 사용한 모범 사례
<?php
require_once '../Scrap.php';
class ScrapTest extends PHPUnit_Framework_TestCase
{
protected $scrap;
// Setup function to instantiate de object to $this->scrap
protected function setUp()
{
$this->scrap = new Scrap;
}
/**
* @covers Scrap::getPhone
*
*/
public function testGetPhone() {
// Variables
$array_static1 = Array(0 => 218559372, 1 => 927555929, 2 => 213456789, 3 => 912345678);
$phone_list1 = '</div>A Front para<br /><br /><br /><br /><br /><br />-Apoio;<br />-Criação;<br />-Campanhas;<br />-Promoções<br /><br /><br />CONDIÇÕES:<br /><br />Local de Trabalho: Es<br />Folgas: Mistas<br /><br /><br /><br />ordem 500€<br /><br /><br /><br />Mínimos:<br /><br />- Conhecimentos;<br />- Ensino ;<br />-INGLÊS.<br /><br /><br /><br />Candidaturas: <br />[email protected]<br />218559372 | 927 555 929 | <br />RH<br />Rua C. Sal. 40<br />1000-000 Lisboa<br /><br /><br />+351 21 3456789 | (351) 912345678';
$this->assertEquals($array_static1, $this->scrap->getPhone($phone_list1, '351', '9'));
}
}
?>
내가 이것보다 BETER 수행 할 수 있습니다
내 첫 번째 테스트는 다음과 같습니다? 이것이 올바른 방법인가?
내게 몇 가지 단서를 줄 수 있다면 감사하겠습니다. 나는이 경우 phpunit을의 dataProvider 기능을 사용