Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class AnnotationsTest extends PHPUNit_Framework_TestCase
- {
- public function testMethodRaiseException()
- {
- try {
- $iterator = new ArrayIterator(42);
- $this->fail();
- } catch (InvalidArgumentException $e) {
- }
- }
- /**
- * @expectedException InvalidArgumentException
- */
- public function testMethodRaiseExceptionAgain()
- {
- $iterator = new ArrayIterator(42);
- }
- public function testBooleanEvaluationInALoop()
- {
- $values = array(1, '1', 'on', true);
- foreach ($values as $value) {
- $actual = (bool) $value;
- $this->assertTrue($actual);
- }
- }
- public static function trueValues()
- {
- return array(
- array(1),
- array('1'),
- array('on'),
- array(true)
- );
- }
- /**
- * @dataProvider trueValues
- */
- public function testBooleanEvaluation($value)
- {
- $actual = (bool) $value;
- $this->assertTrue($actual);
- }
- public function testArrayAdditionWorks()
- {
- $array = array();
- $array[0] = 'foo';
- $this->assertTrue(isset($array[0]));
- return $array;
- }
- /**
- * @depends testArrayAdditionWorks
- */
- public function testArrayRemovalWorks($fixture)
- {
- unset($fixture[0]);
- $this->assertFalse(isset($fixture[0]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement