$behaviors['corsFilter'] = [
'class' => Cors::className(),
'cors' => [
'Origin' => ['*'],
'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
'Access-Control-Request-Headers' => ['*'],
'Access-Control-Allow-Credentials' => true,
],
];
bcdedit /set hypervisorlaunchtype off
git clone https://github.com/userName/Repo New_Repo
cd New_Repo
git remote set-url origin https://github.com/userName/New_Repo
git remote add upstream https://github.com/userName/Repo
git push origin master
git push --all
public function rules()
{
return [
['field1','field2'],'filter','filter'=>'\yii\helpers\HtmlPurifier::process']
];
}
class MyTest extends \PHPUnit\Framework\TestCase
{
public function testDoSomethingOne(): void
{
/** @var \PHPUnit\Framework\MockObject\MockObject $mockOfA */
$mockOfA = $this->getMockBuilder(A::class)->getMock();
$mockOfA->expects($this->once())
->method('setData')
->with(20);
(new B)->doSomething($mockOfA, 1);
}
public function testDoSomethingTwo(): void
{
/** @var \PHPUnit\Framework\MockObject\MockObject $mockOfA */
$mockOfA = $this->getMockBuilder(A::class)->getMock();
$mockOfA->expects($this->once())
->method('setData')
->with(10000);
(new B)->doSomething($mockOfA, 100);
}
}
The practice of replacing an object with a test double that verifies expectations, for instance asserting that a method has been called, is referred to as mocking.