Skip to content

Commit

Permalink
Make test suite code compatible with php 5.3.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeylukin committed Nov 7, 2014
1 parent 2191c93 commit 1a11800
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/Nulpunkt/PhpStub/StubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StubTest extends \PHPUnit_Framework_TestCase
{
public function testThatAStubRespondToDefinedMethods()
{
$stub = new Stub(['getId' => 42]);
$stub = new Stub(array('getId' => 42));
$this->assertSame(42, $stub->getId());
}

Expand All @@ -20,19 +20,19 @@ public function testThatItHasAllProperties()

public function testCanAccessAsProperty()
{
$stub = new Stub(['property' => 42]);
$stub = new Stub(array('property' => 42));
$this->assertSame(42, $stub->property);
}

public function testPropertiesCanBeSeenByIsset()
{
$stub = new Stub(['property' => 42]);
$stub = new Stub(array('property' => 42));
$this->assertTrue(isset($stub->property), 'Properies can be seen by isset');
}

public function testPropertiesCanBeUnset()
{
$stub = new Stub(['property' => 42]);
$stub = new Stub(array('property' => 42));
unset($stub->property);
$this->assertFalse(isset($stub->property), 'Properies can be unset');
}
Expand All @@ -43,13 +43,13 @@ public function testThatItWillCallAAnonomusCallable()
return $argument;
};

$stub = new Stub(['identity' => $identity]);
$stub = new Stub(array('identity' => $identity));
$this->assertSame(42, $stub->identity(42));
}

public function testThatItWillCallANamedCallable()
{
$stub = new Stub(['callMe' => [$this, 'callMeMaybe']]);
$stub = new Stub(array('callMe' => array($this, 'callMeMaybe')));
$this->assertSame("Hello, Rebecca", $stub->callMe("Rebecca"));
}

Expand All @@ -67,7 +67,7 @@ public function testThatItReturnsItSelfIfNothingElse()

public function testThatItReturnsNullIfConfigured()
{
$stub = new Stub([], ['chainable' => false]);
$stub = new Stub(array(), array('chainable' => false));
$this->assertSame(null, $stub->getId());
}

Expand All @@ -76,7 +76,7 @@ public function testThatItReturnsNullIfConfigured()
*/
public function testThatItThrowsIfConfigured()
{
$stub = new Stub([], ['throw' => true]);
$stub = new Stub(array(), array('throw' => true));
$stub->getId();
}

Expand All @@ -87,12 +87,12 @@ public function testThatItThrowsIfConfigured()
public function testThatItThrowsSpecifiedExceptionIfConfigured()
{
$stub = new Stub(
[],
[
array(),
array(
'throw' => true,
'exceptionclass' => 'InvalidArgumentException',
'exceptionmessage' => 'Bad method call'
]
)
);
$stub->getId();
}
Expand Down

0 comments on commit 1a11800

Please sign in to comment.