Skip to content

Commit

Permalink
Merge 266897a into 5f146b7
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Jan 19, 2014
2 parents 5f146b7 + 266897a commit 9faf949
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion tests/Mockery/AdhocTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function setup ()
{
$this->container = new \Mockery\Container(\Mockery::getDefaultGenerator(), \Mockery::getDefaultLoader());
}

public function teardown()
{
$this->container->mockery_close();
Expand Down
8 changes: 4 additions & 4 deletions tests/Mockery/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public function testMockedStaticMethodsObeyMethodCounting()
* @expectedException BadMethodCallException
*/
public function testMockedStaticThrowsExceptionWhenMethodDoesNotExist(){
\Mockery::setContainer($this->container);
\Mockery::setContainer($this->container);
$m = $this->container->mock('alias:MyNamespace\StaticNoMethod');
$this->assertEquals('bar', \MyNameSpace\StaticNoMethod::staticFoo());
\Mockery::resetContainer();
Expand Down Expand Up @@ -844,9 +844,9 @@ public function testMethodsReturningParamsByReferenceDoesNotErrorOut()

public function testMockCallableTypeHint()
{
if(PHP_VERSION_ID >= 50400) {
$this->container->mock('MockeryTest_MockCallableTypeHint');
}
if(PHP_VERSION_ID >= 50400) {
$this->container->mock('MockeryTest_MockCallableTypeHint');
}
}

public function testCanMockClassWithReservedWordMethod()
Expand Down
2 changes: 1 addition & 1 deletion tests/Mockery/Generator/MockConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ interface TestTraversableInterface3 extends \Traversable, \IteratorAggregate {}

final class TestFinal {}

interface TestInterface
interface TestInterface
{
public function foo();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CallTypeHintPassTest extends \PHPUnit_Framework_TestCase
{
const CODE = ' public function __call($method, array $args) {}
const CODE = ' public function __call($method, array $args) {}
public static function __callStatic($method, array $args) {}
';

Expand All @@ -22,8 +22,8 @@ public function shouldRemoveCallTypeHintIfRequired()
))->shouldDeferMissing();
$code = $pass->apply(static::CODE, $config);
$this->assertContains('__call($method, $args)', $code);
}
}

/**
* @test
*/
Expand All @@ -35,5 +35,5 @@ public function shouldRemoveCallStaticTypeHintIfRequired()
))->shouldDeferMissing();
$code = $pass->apply(static::CODE, $config);
$this->assertContains('__callStatic($method, $args)', $code);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
class ClassNamePassTest extends \PHPUnit_Framework_TestCase
{
const CODE = "namespace Mockery; class Mock {}";

public function setup()
{
$this->pass = new ClassNamePass();
}
}

/**
* @test
Expand All @@ -23,7 +23,7 @@ public function shouldRemoveNamespaceDefinition()
$config = new MockConfiguration(array(), array(), array(), "Dave\Dave");
$code = $this->pass->apply(static::CODE, $config);
$this->assertNotContains('namespace Mockery;', $code);
}
}

/**
* @test
Expand All @@ -34,7 +34,7 @@ public function shouldReplaceNamespaceIfClassNameIsNamespaced()
$code = $this->pass->apply(static::CODE, $config);
$this->assertNotContains('namespace Mockery;', $code);
$this->assertContains('namespace Dave;', $code);
}
}

/**
* @test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public function shouldAddAnyInterfaceNamesToImplementsDefinition()

$this->assertContains("implements MockInterface, \Dave\Dave, \Paddy\Paddy", $code);
}

}
12 changes: 6 additions & 6 deletions tests/Mockery/HamcrestExpectationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ public function setUp()
$this->container = new \Mockery\Container(\Mockery::getDefaultGenerator(), \Mockery::getDefaultLoader());
$this->mock = $this->container->mock('foo');
}


public function tearDown()
{
\Mockery::getConfiguration()->allowMockingNonExistentMethods(true);
$this->container->mockery_close();
}

/** Just a quickie roundup of a few Hamcrest matchers to check nothing obvious out of place **/

public function testAnythingConstraintMatchesArgument()
{
$this->mock->shouldReceive('foo')->with(anything())->once();
$this->mock->foo(2);
$this->container->mockery_verify();
}

public function testGreaterThanConstraintMatchesArgument()
{
$this->mock->shouldReceive('foo')->with(greaterThan(1))->once();
$this->mock->foo(2);
$this->container->mockery_verify();
}

/**
* @expectedException Mockery\Exception
*/
Expand All @@ -60,5 +60,5 @@ public function testGreaterThanConstraintNotMatchesArgument()
$this->mock->foo(1);
$this->container->mockery_verify();
}

}
2 changes: 1 addition & 1 deletion tests/Mockery/Loader/EvalLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class EvalLoaderTest extends LoaderTestCase
public function getLoader()
{
return new EvalLoader();
}
}
}
2 changes: 1 addition & 1 deletion tests/Mockery/Loader/RequireLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class RequireLoaderTest extends LoaderTestCase
public function getLoader()
{
return new RequireLoader(sys_get_temp_dir());
}
}
}
2 changes: 1 addition & 1 deletion tests/Mockery/MockClassWithUnknownTypeHintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace test\Mockery;

class MockClassWithUnknownTypeHintTest extends \PHPUnit_Framework_TestCase
class MockClassWithUnknownTypeHintTest extends \PHPUnit_Framework_TestCase
{
protected function setUp() {
$this->container = new \Mockery\Container;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mockery/MockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function setup ()
{
$this->container = new \Mockery\Container(\Mockery::getDefaultGenerator(), \Mockery::getDefaultLoader());
}

public function teardown()
{
$this->container->mockery_close();
Expand Down
12 changes: 6 additions & 6 deletions tests/Mockery/MockingProtectedMethodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function teardown()
$this->container->mockery_close();
}

/**
* @test
/**
* @test
*
* This is a regression test, basically we don't want the mock handling
* This is a regression test, basically we don't want the mock handling
* interfering with calling protected methods partials
*/
public function shouldAutomaticallyDeferCallsToProtectedMethodsForPartials()
Expand All @@ -46,10 +46,10 @@ public function shouldAutomaticallyDeferCallsToProtectedMethodsForPartials()
$this->assertEquals("bar", $mock->bar());
}

/**
* @test
/**
* @test
*
* This is a regression test, basically we don't want the mock handling
* This is a regression test, basically we don't want the mock handling
* interfering with calling protected methods partials
*/
public function shouldAutomaticallyDeferCallsToProtectedMethodsForRuntimePartials()
Expand Down
42 changes: 21 additions & 21 deletions tests/Mockery/RecorderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function setup ()
{
$this->container = new \Mockery\Container(\Mockery::getDefaultGenerator(), \Mockery::getDefaultLoader());
}

public function teardown()
{
$this->container->mockery_close();
Expand All @@ -39,35 +39,35 @@ public function testRecorderWithSimpleObject()
$user = new MockeryTestSubjectUser($subject);
$user->doFoo();
});

$this->assertEquals(1, $mock->foo());
$mock->mockery_verify();
}

public function testArgumentsArePassedAsMethodExpectations()
{
$mock = $this->container->mock(new MockeryTestSubject);
$mock->shouldExpect(function ($subject) {
$user = new MockeryTestSubjectUser($subject);
$user->doBar();
});

$this->assertEquals(4, $mock->bar(2));
$mock->mockery_verify();
}

public function testArgumentsLooselyMatchedByDefault()
{
$mock = $this->container->mock(new MockeryTestSubject);
$mock->shouldExpect(function ($subject) {
$user = new MockeryTestSubjectUser($subject);
$user->doBar();
});

$this->assertEquals(4, $mock->bar('2'));
$mock->mockery_verify();
}

public function testMultipleMethodExpectations()
{
$mock = $this->container->mock(new MockeryTestSubject);
Expand All @@ -76,12 +76,12 @@ public function testMultipleMethodExpectations()
$user->doFoo();
$user->doBar();
});

$this->assertEquals(1, $mock->foo());
$this->assertEquals(4, $mock->bar(2));
$mock->mockery_verify();
}

public function testRecordingDoesNotSpecifyExactOrderByDefault()
{
$mock = $this->container->mock(new MockeryTestSubject);
Expand All @@ -90,12 +90,12 @@ public function testRecordingDoesNotSpecifyExactOrderByDefault()
$user->doFoo();
$user->doBar();
});

$this->assertEquals(4, $mock->bar(2));
$this->assertEquals(1, $mock->foo());
$mock->mockery_verify();
}

/**
* @expectedException \Mockery\Exception
*/
Expand All @@ -108,12 +108,12 @@ public function testRecordingDoesSpecifyExactOrderInStrictMode()
$user->doFoo();
$user->doBar();
});

$mock->bar(2);
$mock->foo();
$mock->mockery_verify();
}

/**
* @expectedException \Mockery\Exception
*/
Expand All @@ -125,10 +125,10 @@ public function testArgumentsAreMatchedExactlyUnderStrictMode()
$user = new MockeryTestSubjectUser($subject);
$user->doBar();
});

$mock->bar('2');
}

/**
* @expectedException \Mockery\Exception
*/
Expand All @@ -139,23 +139,23 @@ public function testThrowsExceptionWhenArgumentsNotExpected()
$user = new MockeryTestSubjectUser($subject);
$user->doBar();
});

$mock->bar(4);
}

public function testCallCountUnconstrainedByDefault()
{
$mock = $this->container->mock(new MockeryTestSubject);
$mock->shouldExpect(function ($subject) {
$user = new MockeryTestSubjectUser($subject);
$user->doBar();
});

$mock->bar(2);
$this->assertEquals(4, $mock->bar(2));
$mock->mockery_verify();
}

/**
* @expectedException \Mockery\CountValidator\Exception
*/
Expand All @@ -167,12 +167,12 @@ public function testCallCountConstrainedInStrictMode()
$user = new MockeryTestSubjectUser($subject);
$user->doBar();
});

$mock->bar(2);
$mock->bar(2);
$mock->mockery_verify();
}

}

class MockeryTestSubject {
Expand Down

0 comments on commit 9faf949

Please sign in to comment.