If you want to mock AR that doesn't try to connect to database you can do it in the following way (if using PHPUnit):
$post = $this->getMockBuilder('\app\model\Post')
->setMethods(['save', 'attributes'])
->getMock();
$post->method('save')->willReturn(true);
$post->meth...