本文整理汇总了PHP中Guzzle\Common\Version::emitWarnings方法的典型用法代码示例。如果您正苦于以下问题:PHP Version::emitWarnings方法的具体用法?PHP Version::emitWarnings怎么用?PHP Version::emitWarnings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Common\Version
的用法示例。
在下文中一共展示了Version::emitWarnings方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
if (!version_compare(Version::VERSION, '3.6', '>=')) {
$this->markTestSkipped('the emitWarning property was added in Guzzle 3.6');
}
$this->container = new ContainerBuilder();
$this->extension = new MisdGuzzleExtension();
// reset the emit warnings options before each test
Version::$emitWarnings = false;
}
示例2: testAddsDigestAuthentication
public function testAddsDigestAuthentication()
{
Version::$emitWarnings = false;
$plugin = new CurlAuthPlugin('julian', 'test', CURLAUTH_DIGEST);
$client = new Client('http://www.test.com/');
$client->getEventDispatcher()->addSubscriber($plugin);
$request = $client->get('/');
$this->assertEquals('julian', $request->getUsername());
$this->assertEquals('test', $request->getPassword());
$this->assertEquals('julian:test', $request->getCurlOptions()->get(CURLOPT_USERPWD));
$this->assertEquals(CURLAUTH_DIGEST, $request->getCurlOptions()->get(CURLOPT_HTTPAUTH));
Version::$emitWarnings = true;
}
示例3: testCanGetScannedCount
public function testCanGetScannedCount()
{
$emitWarnings = Version::$emitWarnings;
Version::$emitWarnings = false;
$command = $this->getMock('Guzzle\\Service\\Command\\CommandInterface');
$iterator = new ScanIterator($command, array('result_key' => 'Items'));
$model = new Model(array('Items' => array(1, 2, 3), 'ScannedCount' => 4));
$class = new \ReflectionObject($iterator);
$method = $class->getMethod('handleResults');
$method->setAccessible(true);
$items = $method->invoke($iterator, $model);
$this->assertEquals(4, $iterator->getScannedCount());
$this->assertCount(3, $items);
Version::$emitWarnings = $emitWarnings;
}
示例4: load
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$loader->load('plugin.xml');
$loader->load('log.xml');
if ($config['serializer']) {
$loader->load('serializer.xml');
}
if (interface_exists('Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterInterface')) {
// choose a ParamConverterInterface implementation that is compatible
// with the version of SensioFrameworkExtraBundle being used
$parameter = new \ReflectionParameter(array('Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterInterface', 'supports'), 'configuration');
if ('Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ParamConverter' == $parameter->getClass()->getName()) {
$container->setParameter('misd_guzzle.param_converter.class', 'Misd\\GuzzleBundle\\Request\\ParamConverter\\GuzzleParamConverter3x');
} else {
$container->setParameter('misd_guzzle.param_converter.class', 'Misd\\GuzzleBundle\\Request\\ParamConverter\\GuzzleParamConverter2x');
}
$loader->load('param_converter.xml');
}
if ($config['service_builder']['enabled']) {
$loader->load('service_builder.xml');
$container->setParameter('guzzle.service_builder.class', $config['service_builder']['class']);
$container->setParameter('guzzle.service_builder.configuration_file', $config['service_builder']['configuration_file']);
}
if ($config['filesystem_cache']['enabled']) {
$loader->load('cache.xml');
$container->setParameter('misd_guzzle.cache.filesystem.path', $config['filesystem_cache']['path']);
}
$logFormat = $config['log']['format'];
if (in_array($logFormat, array('default', 'debug', 'short'))) {
$logFormat = constant(sprintf('Guzzle\\Log\\MessageFormatter::%s_FORMAT', strtoupper($logFormat)));
}
$container->setParameter('misd_guzzle.log.format', $logFormat);
$container->setParameter('misd_guzzle.log.enabled', $config['log']['enabled']);
if (version_compare(Version::VERSION, '3.6', '>=') && $container->hasParameter('kernel.debug')) {
Version::$emitWarnings = $container->getParameter('kernel.debug');
}
}
示例5: testAllowsDefaultHeaders
public function testAllowsDefaultHeaders()
{
Version::$emitWarnings = false;
$default = array('X-Test' => 'Hi!');
$other = array('X-Other' => 'Foo');
$client = new Client();
$client->setDefaultHeaders($default);
$this->assertEquals($default, $client->getDefaultHeaders()->getAll());
$client->setDefaultHeaders(new Collection($default));
$this->assertEquals($default, $client->getDefaultHeaders()->getAll());
$request = $client->createRequest('GET', null, $other);
$this->assertEquals('Hi!', $request->getHeader('X-Test'));
$this->assertEquals('Foo', $request->getHeader('X-Other'));
$request = $client->createRequest('GET', null, new Collection($other));
$this->assertEquals('Hi!', $request->getHeader('X-Test'));
$this->assertEquals('Foo', $request->getHeader('X-Other'));
$request = $client->createRequest('GET');
$this->assertEquals('Hi!', $request->getHeader('X-Test'));
Version::$emitWarnings = true;
}
示例6: testCanSilenceWarnings
public function testCanSilenceWarnings()
{
Version::$emitWarnings = false;
Version::warn('testing!');
Version::$emitWarnings = true;
}