-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
howyi
committed
Aug 1, 2017
1 parent
e84b75d
commit 76a2cde
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,5 +46,4 @@ public function getNextAfterField() | |
{ | ||
return $this->nextAfterField; | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Conv\Util; | ||
|
||
class FieldOrderTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testConstruct() | ||
{ | ||
$field = 'user_name'; | ||
$previousAfterField = 'user_id'; | ||
$nextAfterField = 'age'; | ||
$fieldOrder = new FieldOrder($field, $previousAfterField, $nextAfterField); | ||
$this->assertSame($field, $fieldOrder->getField()); | ||
$this->assertSame($previousAfterField, $fieldOrder->getPreviousAfterField()); | ||
$this->assertSame($nextAfterField, $fieldOrder->getNextAfterField()); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Conv\Util; | ||
|
||
use Symfony\Component\Console\Helper\QuestionHelper; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Question\ChoiceQuestion; | ||
|
||
class OperatorTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
private $prophet; | ||
|
||
protected function setup() | ||
{ | ||
$this->prophet = new \Prophecy\Prophet; | ||
} | ||
|
||
protected function tearDown() | ||
{ | ||
$this->prophet->checkPredictions(); | ||
} | ||
|
||
public function testConstruct() | ||
{ | ||
$helper = $this->prophet->prophesize(QuestionHelper::class); | ||
$input = $this->prophet->prophesize(InputInterface::class); | ||
$output = $this->prophet->prophesize(OutputInterface::class); | ||
$operator = new Operator($helper->reveal(), $input->reveal(), $output->reveal()); | ||
|
||
$answer = 'answer'; | ||
$helper->ask($input, $output, \Prophecy\Argument::type(ChoiceQuestion::class)) | ||
->willReturn($answer) | ||
->shouldBeCalledTimes(1); | ||
$this->assertSame($answer, $operator->choiceQuestion('question', ['answer'])); | ||
|
||
$message = 'message'; | ||
$output->writeln($message)->shouldBeCalledTimes(1); | ||
$operator->output($message); | ||
} | ||
} |