Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant mock laravel Model #162

Open
lotarbo opened this issue Oct 23, 2018 · 2 comments
Open

Cant mock laravel Model #162

lotarbo opened this issue Oct 23, 2018 · 2 comments

Comments

@lotarbo
Copy link

lotarbo commented Oct 23, 2018

Hi, i use
"codeception/aspect-mock": "^3.0"
"laravel/framework": "5.6."
php 7.1.

Try to do in test
MyModel.php

class MyModel extends Model
{
.....
public function someTest()
{
  return 'old return';
}
.....
}
use AspectMock\Test as test;
......
test::double(MyModel::class, [
            'someTest' => 'new return',
        ]);
$m = new MyModel();
var_dump($m->someTest());
......

i see 'old return', not what i exept;

config file

require __DIR__ . '/autoload.php';
        $kernel = \AspectMock\Kernel::getInstance();
        $kernel->init([
            'debug' => true,
            'cacheDir' => app_path() . '/../storage/framework/cache/data',
            'includePaths' => [
                app_path(),
                app_path() . '/../vendor/laravel',
            ],
            'excludePaths' => [
                app_path() . '/../test',
            ]
        ]);
@panique
Copy link

panique commented May 7, 2020

Same here, desperatly trying to get AspeckMock running, but the setup it quite horrible :/
@lotarbo what do you mean with "config file" ?

@lotarbo
Copy link
Author

lotarbo commented Jun 19, 2020

@panique only showing my environment, mb i missing something in setup)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants