This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/4005' into develop
Forward port zendframework/zendframework#4005
- Loading branch information
126 parents
2eed9db
+
3b93376
+
6c2eca4
+
48bc01e
+
3c88cd5
+
fbfc750
+
441b9de
+
b57e2b9
+
2beef92
+
3ae4add
+
994832b
+
6db3cde
+
e0f83ee
+
712223d
+
3b4ec35
+
e53a267
+
51bf3c7
+
10a1e95
+
30ee303
+
96417b9
+
50ea13f
+
24d1c0c
+
b09295e
+
13758aa
+
99316f8
+
40b8ac3
+
e284e0b
+
8ff51b4
+
4b5ea1e
+
5b24371
+
ed932b6
+
357852d
+
262e5d6
+
9057a3f
+
0e1e846
+
5d11876
+
0ae0984
+
6ff135c
+
0b45aba
+
1778b0c
+
a574713
+
ba3f132
+
56365a6
+
019f89a
+
b09b3ba
+
2af32d0
+
cb39fc7
+
3f8a6fd
+
8999753
+
a7cd86b
+
da1c469
+
5371cdb
+
fd9f625
+
99d3fcd
+
1e3ed17
+
a360459
+
1a1e9aa
+
4c8955c
+
94f2feb
+
5b450ef
+
e64e5b0
+
e9d19a6
+
a5a9b6e
+
5e59c3a
+
a47f2db
+
3cf915a
+
a2a5c91
+
1cd3439
+
ef9c643
+
298a619
+
001ae99
+
c37ab8e
+
017f6f1
+
0711f77
+
38af804
+
23120b4
+
5f96f53
+
a257169
+
8085bc4
+
3110cd4
+
f270d41
+
9536f09
+
4ec1292
+
adcdd78
+
e80fff6
+
99fc5ce
+
1d23e94
+
fa167cb
+
a93e92f
+
13a2df8
+
06689fb
+
2d601eb
+
72a3295
+
a59f42c
+
0f4489d
+
b3f7029
+
3c492ce
+
259bcdc
+
a811ae5
+
f66f985
+
173e949
+
b93077e
+
f11a10d
+
5ac4be0
+
cb31aff
+
d34bdbb
+
725b978
+
27b423e
+
624ac5e
+
a3340ac
+
80ab2e3
+
3429053
+
998a6d7
+
8b9ab71
+
d4dffb0
+
5456435
+
97180fa
+
126be7f
+
c16eb72
+
8ccb096
+
50481b9
+
411738a
+
7a829bf
+
1a7bb52
+
ebf02d3
+
f05077e
commit ca3399f
Showing
10 changed files
with
159 additions
and
42 deletions.
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
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
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
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
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
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
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
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
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,108 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Console\Char; | ||
|
||
use Zend\Console\Prompt\Confirm; | ||
use ZendTest\Console\TestAssets\ConsoleAdapter; | ||
|
||
/** | ||
* @group Zend_Console | ||
*/ | ||
class ConfirmTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var ConsoleAdapter | ||
*/ | ||
protected $adapter; | ||
|
||
public function setUp() | ||
{ | ||
$this->adapter = new ConsoleAdapter(); | ||
$this->adapter->stream = fopen('php://memory', 'w+'); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
fclose($this->adapter->stream); | ||
} | ||
|
||
public function testCanPromptConfirm() | ||
{ | ||
fwrite($this->adapter->stream, 'y'); | ||
|
||
$confirm = new Confirm("Is ZF2 the best framework ?"); | ||
$confirm->setEcho(false); | ||
$confirm->setConsole($this->adapter); | ||
ob_start(); | ||
$response = $confirm->show(); | ||
$text = ob_get_clean(); | ||
$this->assertEquals($text, "Is ZF2 the best framework ?\n"); | ||
$this->assertTrue($response); | ||
} | ||
|
||
public function testCanPromptConfirmWithDefaultIgnoreCase() | ||
{ | ||
fwrite($this->adapter->stream, 'Y'); | ||
|
||
$confirm = new Confirm("Is ZF2 the best framework ?"); | ||
$confirm->setEcho(false); | ||
$confirm->setConsole($this->adapter); | ||
ob_start(); | ||
$response = $confirm->show(); | ||
$text = ob_get_clean(); | ||
$this->assertEquals($text, "Is ZF2 the best framework ?\n"); | ||
$this->assertTrue($response); | ||
} | ||
|
||
public function testCanPromptConfirmWithoutIgnoreCase() | ||
{ | ||
fwrite($this->adapter->stream, 'Yn'); | ||
|
||
$confirm = new Confirm("Is ZF2 the best framework ?"); | ||
$confirm->setEcho(false); | ||
$confirm->setConsole($this->adapter); | ||
$confirm->setIgnoreCase(false); | ||
ob_start(); | ||
$response = $confirm->show(); | ||
$text = ob_get_clean(); | ||
$this->assertEquals($text, "Is ZF2 the best framework ?\n"); | ||
$this->assertFalse($response); | ||
} | ||
|
||
public function testCanPromptConfirmWithYesNoCharChanged() | ||
{ | ||
fwrite($this->adapter->stream, 'on0'); | ||
|
||
$confirm = new Confirm("Is ZF2 the best framework ?", "1", "0"); | ||
$confirm->setEcho(false); | ||
$confirm->setConsole($this->adapter); | ||
ob_start(); | ||
$response = $confirm->show(); | ||
$text = ob_get_clean(); | ||
$this->assertEquals($text, "Is ZF2 the best framework ?\n"); | ||
$this->assertFalse($response); | ||
} | ||
|
||
public function testCanPromptConfirmWithYesNoCharChangedWithSetter() | ||
{ | ||
fwrite($this->adapter->stream, 'oaB'); | ||
|
||
$confirm = new Confirm("Is ZF2 the best framework ?", "1", "0"); | ||
$confirm->setYesChar("A"); | ||
$confirm->setNoChar("B"); | ||
$confirm->setEcho(false); | ||
$confirm->setConsole($this->adapter); | ||
ob_start(); | ||
$response = $confirm->show(); | ||
$text = ob_get_clean(); | ||
$this->assertEquals($text, "Is ZF2 the best framework ?\n"); | ||
$this->assertTrue($response); | ||
} | ||
} |
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