public function testCleanupSpecificClasses() { $service = test::double('demo\\UserService', ['updateName' => 'hello'])->make(); test::double('demo\\UserModel', ['tableName' => 'my_table']); verify(demo\UserModel::tableName())->equals('my_table'); test::clean('demo\\UserModel'); verify(demo\UserModel::tableName())->equals('users'); verify($service->updateName(new \demo\UserModel()))->equals('hello'); }
<?php $loader = (require_once __DIR__ . '/../../vendor/autoload.php'); $loader->add('AspectMock', __DIR__ . '/../../src'); $loader->add('demo', __DIR__); $loader->register(); $kernel = \AspectMock\Kernel::getInstance(); $kernel->init(['debug' => true, 'cacheDir' => __DIR__ . '/cache']); $user = new demo\UserModel(); $user->save();