-- Jigal sanders <[email protected]> wrote (on Wednesday, 03 August 2011, 11:17 PM +0200): > Good night everyone, > > I am trying to figure out some stuff in PHPUnit with Zend Framework. Off > course I am using the default configuration which comes with an out of the > box ZF new project. > > Now i want to test my function which will dynamically load a css file. So to > test if a certain css was loaded i thought to use the > "assertQueryContentContains" function. > > I looked in the api and there it says about the variables: > > $path > string > *CSS selector path*$matchstring > *content that should be contained in matched nodes*$messagestring > > First of all, what's a 'css selector path' selector , can anyone show > me how to use it?
CSS selectors are used in several places: * Within CSS files to determine what is being styled * Within most modern JavaScript frameworks for identifying DOM elements to operate on Basically, they're a simpler, more intuitive way to traverse a DOM tree than XPath. The canonical guide is here: * http://www.w3.org/TR/CSS2/selector.html Sitepoint has a nice reference: * http://reference.sitepoint.com/css/selectorref and you can also look in most JS libraries for examples (jQuery's $() operator uses them, as does dojo.query()). A simple example might be finding all "<pre>" elements within a "<div>" with the attribute "class" set to "content": "div.content pre" If you're at all accustomed to using CSS, the notation should be immediately familiar. > This because i want to be able to query my html5 document and check if there > is any link tag contains my $match. > > Any idea's? $this->assertQueryContentContains("a", $someMatchingContent); -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
