Silex\WebTestCase giving Symfony\Component\Security\Core\SecurityContext class 自 2.6 版起已弃用,将在 3.0 中删除
Silex\WebTestCase giving Symfony\Component\Security\Core\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0
这里是测试class
class CampaignControllerTest extends WebTestCase
{
public function createApplication()
{
$app = CommonFunction::getApplication();
$app['debug'] = true;
$app['exception_handler']->disable();
$app['session.storage'] = $app->share(function() {
return new MockArraySessionStorage();
});
$app['session.test'] = true;
return $app;
}
public function testInitialPage()
{
$client = $this->createClient();
$crawler = $client->request('GET', '/');
$this->assertEquals(1,1);
}
}
当 phpUnit 收到此错误时,知道如何修复它吗?
There was 1 error:
1) CampaignControllerTest::testInitialPage
The Symfony\Component\Security\Core\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage or Symfony\Component\Security\Core\Authorization\AuthorizationChecker instead.
/home/ariful1/imoney/formapply/vendor/symfony/security/Core/SecurityContext.php:14
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:76
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:327
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:252
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:264
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:113
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:540
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Application.php:188
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Application.php:538
/home/ariful1/imoney/formapply/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php:81
/home/ariful1/imoney/formapply/vendor/symfony/browser-kit/Client.php:327
/home/ariful1/imoney/formapply/tests/FormApply/Test/Controller/CampaignControllerTest.php:26
我正在使用 silex 1.2.x 和 phpunit 4.3.* .
这个问题去年在 symfony 框架中弹出。 final solution 是 bootstrap 一个新的错误处理程序,它在 运行 测试时捕获弃用错误。您可以采用相同的解决方案或以其他方式在测试时配置错误报告以忽略 E_USER_DEPRECATED
错误。
这里是测试class
class CampaignControllerTest extends WebTestCase
{
public function createApplication()
{
$app = CommonFunction::getApplication();
$app['debug'] = true;
$app['exception_handler']->disable();
$app['session.storage'] = $app->share(function() {
return new MockArraySessionStorage();
});
$app['session.test'] = true;
return $app;
}
public function testInitialPage()
{
$client = $this->createClient();
$crawler = $client->request('GET', '/');
$this->assertEquals(1,1);
}
}
当 phpUnit 收到此错误时,知道如何修复它吗?
There was 1 error:
1) CampaignControllerTest::testInitialPage
The Symfony\Component\Security\Core\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage or Symfony\Component\Security\Core\Authorization\AuthorizationChecker instead.
/home/ariful1/imoney/formapply/vendor/symfony/security/Core/SecurityContext.php:14
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:76
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:327
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:252
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:264
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:113
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:126
/home/ariful1/imoney/formapply/vendor/pimple/pimple/lib/Pimple.php:83
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php:540
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Application.php:188
/home/ariful1/imoney/formapply/vendor/silex/silex/src/Silex/Application.php:538
/home/ariful1/imoney/formapply/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php:81
/home/ariful1/imoney/formapply/vendor/symfony/browser-kit/Client.php:327
/home/ariful1/imoney/formapply/tests/FormApply/Test/Controller/CampaignControllerTest.php:26
我正在使用 silex 1.2.x 和 phpunit 4.3.* .
这个问题去年在 symfony 框架中弹出。 final solution 是 bootstrap 一个新的错误处理程序,它在 运行 测试时捕获弃用错误。您可以采用相同的解决方案或以其他方式在测试时配置错误报告以忽略 E_USER_DEPRECATED
错误。