草庐IT

test_collection

全部标签

php - Symfony2 : Unable to simulate HTTP authentication in functional test

我正在尝试使用symfony.com上描述的以下技术:http://symfony.com/doc/current/cookbook/testing/http_authentication.html试图对需要用户登录的Controller进行功能测试。到目前为止,我的登录表单正在运行,我可以登录,并且Symfony2调试Web工具栏显示我的用户已通过身份验证。另外,我已经为登录过程本身编写了一个功能测试,这通过了。所以我现在有两种情况,我的登录是有效的。我遇到的唯一问题是,在尝试为其他Controller模拟HTTP身份验证时:$client=static::createClient(

php - 奏鸣曲管理员 - sonata_type_collection : select from the list of existing entities

我正在尝试使用PageHasImage桥接实体在Page和Image实体之间实现多对多关系。在PageAdmin中,我添加了如下字段:->add('galleryImages','sonata_type_collection',array('cascade_validation'=>false,'by_reference'=>false,'type_options'=>array('delete'=>false)),array('edit'=>'inline','inline'=>'table','sortable'=>'position','admin_code'=>'sonata.

php - 拉维 5.1 : How to share a collection in all views?

我需要在所有View中共享一个集合。此集合包含网站新闻:$news=NewsStory::orderBy('created_at','desc')->paginate(5);我该怎么做? 最佳答案 可以分享ViewData所有View之间。只需将这一行添加到App\Providers\AppServiceProvider中的boot()方法:view()->share('news',NewsStory::orderBy('created_at','desc')->paginate(5));

php - 即使在包含 laravel Collective 之后,Laravel 5.1 Blade 也无法正常工作

composer.json{"name":"laravel/laravel","description":"TheLaravelFramework.","keywords":["framework","laravel"],"license":"MIT","type":"project","require":{"php":">=5.5.9","laravel/framework":"5.1.*","laravelcollective/html":"5.1.*"},"require-dev":{"fzaninotto/faker":"~1.4","mockery/mockery":"0.9

基于 PHP Memcache(d) 的 session : Should garbage collection be disabled?

当使用peclmemcached(或者我猜是memcache..)扩展时,是否应该通过将概率设置为0来禁用php的session垃圾收集(例如:session.gc_probability/session.gc_divisor)?由于以下原因,这似乎是合乎逻辑的:A)session过期时间很可能只是通过在存储的key上设置过期时间来简单地存储。EG:每个session都有其到期ttl,并在到期时被memcached简单地清除。B)要清除尚未被memcached本身清除的现有session,memcached扩展必须对存储在memcache守护进程中的所有数据进行完整转储,检查每个键以查

php - 微信: OAuth with test account

实际上,我正在尝试使用微信为我的Web应用程序设置OAuth登录。所以,我在微信上创建了一个帐户,并使用了一个测试帐户来无限访问。因此,在测试帐户配置中,我已成功验证来自微信的token(参见此处:http://admin.wechat.com/wiki/index.php?title=Getting_Started)。在文档中,OAuth在这里解释:http://admin.wechat.com/wiki/index.php?title=User_Profile_via_Web我们必须将用户重定向到此URL进行登录:https://open.weixin.qq.com/connect

PHP 教义 : Test if an object is in an ArrayCollection

我正在尝试使用方法ArrayCollection::contains来查找对象是否已经在我的集合中,但是当我这样做时://MyArrayCollection$lesRoles=$drt->getDrtApplication()->getRoles();$leRole=$lesRoles->first();echo"PropertyappNom:".$leRole->getRleApplication()->getAppNom()."//PropertyappRole:".$leRole->getRleId()."";$role=new\Casgaya\Role(2,$drt->getD

php - Mac 上的 Valet : 502 bad gateway when running test. dev,laravel,php 安装

我在mac上用fpm在本地安装了php71。然后在去“pinganyting.dev”时让代客工作。然后进入“PHP_Apps”目录,我在其中安装了所有PHP应用程序,并在该目录中运行“代客泊车”。我在其中创建了一个包含index.php文件的“测试”目录。在浏览器中转到index.dev显示:502BadGatewaynginx/1.10.2还有日志文件记录:2017/01/3116:58:48[crit]285#0:*16connect()tounix:/Users/ME/.valet/valet.sockfailed(2:Nosuchfileordirectory)whileco

php - 如何通过索引将项目添加到 Laravel Eloquent Collection 中?

我尝试了以下但它不起作用。$index=2;$collection->put($index,$item4);例如,如果$collection看起来像这样:$collection=[$item1,$item2,$item3];我想结束:$collection=[$item1,$item2,$item4,$item3]; 最佳答案 最简单的方法可能是拼接它,像这样:$collection->splice(2,0,[$item4]);集合通常支持与常规PHP数组相同的功能。在这种情况下,它是array_splice()在幕后使用的函数。通

php - Count Doctrine 的 iterate() Collection Result

有一个QueryBuilder结果$query=$em->createQuery("SELECT....");通过iterate()方法获取它们http://doctrine-orm.readthedocs.org/en/2.0.x/reference/batch-processing.html$objects=$query->iterate();我现在可以foreach($objectsas$object){$object=$object[0];//dosomething..$object->getObjectId();...}但是...//aftertheiterate()call