Codeception / Codeception/AspectMock

Cant mock laravel Model

Open
#162 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
784
Forks
132
PR merge metrics
No merged PRs in 30d

Description

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',
]
]);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.