Skip to content

Instantly share code, notes, and snippets.

@felixkiss
Last active December 18, 2015 02:48
Show Gist options
  • Save felixkiss/5713116 to your computer and use it in GitHub Desktop.
Save felixkiss/5713116 to your computer and use it in GitHub Desktop.
$ phpunit
PHPUnit 3.7.19 by Sebastian Bergmann.
Configuration read from /Users/felix/code/Laravel-Test-Helpers/phpunit.xml
..FF
Time: 0 seconds, Memory: 4.50Mb
There were 2 failures:
1) WrapperTest::testAssertShouldHaveCustomTestHelper
The 'validate' method does not exist on this model.
Failed asserting that false is true.
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/ModelHelpers.php:51
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/ModelHelpers.php:14
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/TestFacade.php:42
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/TestFacade.php:26
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/TestFacade.php:56
/Users/felix/code/Laravel-Test-Helpers/tests/Way/Tests/WrapperTest.php:18
/Users/felix/code/Laravel-Test-Helpers/tests/Way/Tests/WrapperTest.php:18
2) WrapperTest::testShouldShouldHaveCustomTestHelper
The 'validate' method does not exist on this model.
Failed asserting that false is true.
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/ModelHelpers.php:51
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/ModelHelpers.php:14
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/TestFacade.php:42
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/TestFacade.php:26
/Users/felix/code/Laravel-Test-Helpers/src/Way/Tests/TestFacade.php:56
/Users/felix/code/Laravel-Test-Helpers/tests/Way/Tests/WrapperTest.php:25
/Users/felix/code/Laravel-Test-Helpers/tests/Way/Tests/WrapperTest.php:25
<?php
use Way\Tests\Should;
use Way\Tests\Assert;
use Mockery as m;
class WrapperTest extends PHPUnit_Framework_Testcase {
public function tearDown()
{
m::close();
}
public function testAssertShouldHaveCustomTestHelper()
{
$model = m::mock(array('validate' => true));
// $model->shouldReceive('validate')->once()->andReturn(true);
Assert::valid($model);
}
public function testShouldShouldHaveCustomTestHelper()
{
$model = m::mock(array('validate' => true));
// $model->shouldReceive('validate')->once()->andReturn(true);
Should::beValid($model);
}
}
@felixkiss
Copy link
Author

Why doesn't $model->validate() exist?
Mockery::mock() should give me an object that does indeed include a validate() method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment