forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit tests for new Zend/Form/Element/File elements
- Loading branch information
Showing
6 changed files
with
128 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Form | ||
*/ | ||
|
||
namespace ZendTest\Form\Element\File; | ||
|
||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Zend\Form\Element\File\ApcProgress as ApcProgressElement; | ||
|
||
class ApcProgressTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
if (false === ini_get('apc.rfc1867_name')) { | ||
$this->markTestSkipped('APC module is not active'); | ||
} | ||
} | ||
|
||
public function testAlwaysReturnsApcName() | ||
{ | ||
$name = ini_get('apc.rfc1867_name'); | ||
$element = new ApcProgressElement('foo'); | ||
$this->assertEquals($name, $element->getName()); | ||
$element->setName('bar'); | ||
$this->assertEquals($name, $element->getName()); | ||
} | ||
|
||
public function testValueIsPopulatedWithUniqueId() | ||
{ | ||
$element = new ApcProgressElement(); | ||
$value1 = $element->getValue(); | ||
$this->assertNotEmpty($value1); | ||
$element->setValue(null); | ||
$value2 = $element->getValue(); | ||
$this->assertNotEmpty($value2); | ||
$this->assertNotEquals($value2, $value1); | ||
} | ||
} |
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,44 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Form | ||
*/ | ||
|
||
namespace ZendTest\Form\Element\File; | ||
|
||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Zend\Form\Element\File\SessionProgress as SessionProgressElement; | ||
|
||
class SessionProgressTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
if (false === ini_get('session.upload_progress.name')) { | ||
$this->markTestSkipped('Session Upload Progress feature is not active'); | ||
} | ||
} | ||
|
||
public function testAlwaysReturnsSessionName() | ||
{ | ||
$name = ini_get('session.upload_progress.name'); | ||
$element = new SessionProgressElement('foo'); | ||
$this->assertEquals($name, $element->getName()); | ||
$element->setName('bar'); | ||
$this->assertEquals($name, $element->getName()); | ||
} | ||
|
||
public function testValueIsPopulatedWithUniqueId() | ||
{ | ||
$element = new SessionProgressElement(); | ||
$value1 = $element->getValue(); | ||
$this->assertNotEmpty($value1); | ||
$element->setValue(null); | ||
$value2 = $element->getValue(); | ||
$this->assertNotEmpty($value2); | ||
$this->assertNotEquals($value2, $value1); | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Form | ||
*/ | ||
|
||
namespace ZendTest\Form\Element\File; | ||
|
||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Zend\Form\Element\File\UploadProgress as UploadProgressElement; | ||
|
||
class UploadProgressTest extends TestCase | ||
{ | ||
public function testAlwaysReturnsUploadIdName() | ||
{ | ||
$name = 'UPLOAD_IDENTIFIER'; | ||
$element = new UploadProgressElement('foo'); | ||
$this->assertEquals($name, $element->getName()); | ||
$element->setName('bar'); | ||
$this->assertEquals($name, $element->getName()); | ||
} | ||
|
||
public function testValueIsPopulatedWithUniqueId() | ||
{ | ||
$element = new UploadProgressElement(); | ||
$value1 = $element->getValue(); | ||
$this->assertNotEmpty($value1); | ||
$element->setValue(null); | ||
$value2 = $element->getValue(); | ||
$this->assertNotEmpty($value2); | ||
$this->assertNotEquals($value2, $value1); | ||
} | ||
} |