在Symfony2文档中,它提供了一个简单的示例:
$client->request('POST', '/submit', array('name' => 'Fabien'), array('photo' => '/path/to/photo'));
Run Code Online (Sandbox Code Playgroud)
模拟文件上传.
但是在我的所有测试中,我在应用程序中的$ request对象中没有得到任何内容,并且$_FILES数组中没有任何内容.
这是一个简单WebTestCase的失败.它是自包含的,并$client根据您传入的参数测试构造的请求.它不测试应用程序.
class UploadTest extends WebTestCase {
public function testNewPhotos() {
$client = $this->createClient();
$client->request(
'POST',
'/submit',
array('name' => 'Fabien'),
array('photo' => __FILE__)
);
$this->assertEquals(1, count($client->getRequest()->files->all()));
}
}
Run Code Online (Sandbox Code Playgroud)
只是为了清楚.这不是关于如何进行文件上传的问题,我可以做.它是关于如何在Symfony2中测试它们.
编辑
我确信我做得对.所以我已经为Framework创建了一个测试并发出了拉取请求. https://github.com/symfony/symfony/pull/1891
phpunit integration-testing file-upload functional-testing symfony
在我正在使用的库中,我的任务是将元素移动到dom的前面.(我把它做得更大所以我需要看到它,然后当鼠标移出时缩回它).
我正在使用的库有一个简洁的解决方案,它使用活动元素上的appendChildren将它移动到它的父节点的末端,从而进一步朝着dom的末尾移动,然后在顶部.
问题是我相信,因为您正在移动的元素是您在鼠标移动事件上移动的元素丢失.您的鼠标仍在节点上,但未触发mouseout事件.
我已经删除了功能以确认问题.它在Firefox中运行良好,但在任何版本的IE中都没有.我在这里使用jquery来提高速度.解决方案可以是简单的旧javascript ..这将是一个偏好,因为它可能需要回到上游.
我不能在这里使用z-index,因为元素是vml,库是Raphael,我正在使用toFront调用.使用ul/li的示例在一个简单示例中显示问题
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="js/jquery.min.js" type="text/javascript"></script>
<style>
li
{
border:1px solid black;
}
</style>
</head>
<body>
<ul><li>Test 1</li></ul>
<ul><li>Test 2</li></ul>
<ul><li>Test 3</li></ul>
<ul><li>Test 4</li></ul>
<script>
$(function(){
$("li").mouseover(function(){
$(this).css("border-color","red");
this.parentNode.appendChild(this);
});
$("li").mouseout(function(){
$(this).css("border-color","black");
});
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
编辑:这是一个js粘贴bin的链接,以查看它的实际效果.http://jsbin.com/obesa4
**编辑2:**在发布更多信息之前,请查看所有答案的所有评论.
我正在采取Sencha touch的第一步.结果正是我所追求的,然而到达那里却很难得到如何将sencha放在一起.我正在慢慢搞清楚,但有时代码的工作方式有点WTF.
我正在尝试构建一个非常简单的应用程序,执行以下操作.
1)有三个选项卡,搜索附近(地理位置),快速关键字搜索,类别搜索.
2)每个选项卡搜索返回结果列表
3)每个行都可以单击以显示更多信息.
我已经想出了我认为的标签.
像这样:
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
var location = new Ext.Container({
iconCls: 'search',
title: 'Location Search',
items: [new Ext.Component({
html: '<img src="images/gfb.gif" />'
})]
});
var quick = new Ext.Container({
iconCls: 'search',
title: 'Quick Search',
scroll: 'vertical',
items: [new Ext.Component({
html: '<img src="images/gfb.gif" />'
})]
});
var category = new Ext.Component({
iconCls: 'search',
title: 'Category Search',
html: '<img src="images/gfb.gif" /><p>Category</p>'
});
var tabpanel = new Ext.TabPanel({ …Run Code Online (Sandbox Code Playgroud) 我是第一次做OO javascript.我已经阅读了有关继承和原型的内容,并认为我已经破解了它.直到我发现这个小例子.
function TestObject(data)
{
this.test_array = [];
this.clone_array = [];
this.dosomestuff = function()
{
for(var i=0; i<this.test_array.length; i++)
{
this.clone_array[i]=this.test_array[i];
}
}
this.__construct = function(data)
{
console.log("Testing Object Values" ,this.clone_array);
this.test_array = data;
};
}
TestObject2.prototype = new TestObject();
function TestObject2(data)
{
this.__construct(data);
this.dothings = function()
{
this.dosomestuff();
}
}
Run Code Online (Sandbox Code Playgroud)
如果我执行以下操作:
var foo = new TestObject2([1,2,3,4]);
foo.dothings();
var bar = new TestObject2([4,5,6]);
bar.dothings();
Run Code Online (Sandbox Code Playgroud)
我希望控制台显示:
Testing Object Values, []
Testing Object Values, []
Run Code Online (Sandbox Code Playgroud)
但它显示:
Testing Object Values, []
Testing Object …Run Code Online (Sandbox Code Playgroud) 我们从设计机构继承了一个经典的ASP网站,该网站只是希望我们进行搜索和替换以更改SMTP主机.没问题,我们是PHP商店,但可以把手转向大多数事情.
在进一步调查中发现我们需要使用新的SMTP服务器进行身份验证.
一些谷歌搜索引导我们相信它正在使用ASPMail 4并根据文档它不进行身份验证.
http://www.serverobjects.com/comp/Aspmail4.htm
我们只是用这个电话搜索了"SMTPsvg.Mailer":
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Run Code Online (Sandbox Code Playgroud)
我在假设上面是ASPMail 4并且APSMAil不进行身份验证时是否正确?
如果我需要替换Aspmail,我可以用什么来验证SMTP服务器?
javascript ×3
asp-classic ×1
extjs ×1
file-upload ×1
inheritance ×1
mouseevent ×1
mouseout ×1
phpunit ×1
raphael ×1
sencha-touch ×1
smtp ×1
symfony ×1