This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hello() | |
return x+y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** no dependency injection example */ | |
public function testNoDependencyInjectionNeeded(){ | |
$object = new NoDependencyInjectionNeeded(); | |
$original = $object->getName(); | |
$this->assertEquals('users — No Dependency Injection Needed', $original); | |
Moke::double('App\AspectMock\UserModel', ['tableName' => 'my_users']); | |
$mokedName = $object->getName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** simple mock example */ | |
public function testTableName() | |
{ | |
$tableName = UserModel::tableName(); | |
$this->assertEquals('users', $tableName); | |
$userModel = Moke::double('App\AspectMock\UserModel', ['tableName' => 'my_users']); | |
$name = UserModel::tableName(); | |
$this->assertEquals('my_users', $name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserModel | |
{ | |
public static function tableName() | |
{ | |
return 'users'; | |
} | |
public static function someMethod($arg1, $arg2) | |
{ | |
return $arg1 . ' '. $arg2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Core\Test; | |
/** | |
* My Class : example to show the case of Standard PHP functions | |
* | |
* Class User | |
* | |
* @package App\Core\Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Core\Test; | |
/** | |
* User Model : example to show the use of static methos | |
* | |
* Class UserModel | |
* | |
* @package App\Core\Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Core\Test; | |
use UserModel; | |
/** | |
* My Class : example to show the case of no dependency injection | |
* | |
* Class MyClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$kernel = \AspectMock\Kernel::getInstance(); | |
$kernel->init([ | |
'appDir' => _DIR_ . '/..', | |
'debug' => true, | |
'includePaths' => [ | |
_DIR_ . '/../vendor/laravel', | |
_DIR_ . '/../app' | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace tests\AspectMock; | |
use Codeception\TestCase\Test; | |
use App\AspectMock\UserModel; | |
use App\AspectMock\NoDependencyInjectionNeeded; | |
use App\AspectMock\User2; | |
use AspectMock\Test as Moke; | |
class AspectMockTest extends Test | |
{ |