Skip to content

Commit 86d9513

Browse files
committed
nette/tester 2.5.5
1 parent e779967 commit 86d9513

16 files changed

+400
-224
lines changed

tester/bg/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@
44

55
DomQuery .[#toc-domquery]
66
-------------------------
7-
`Tester\DomQuery` е клас, разширяващ `SimpleXMLElement` с методи за улесняване на тестването на HTML или XML съдържание.
7+
`Tester\DomQuery` разширява `SimpleXMLElement` с лесни заявки за HTML или XML с помощта на селектори CSS.
88

99
```php
10-
# в $html е низ с HTML документа, а в $dom получаваме кореновия елемент
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# we can test the presence of elements using CSS selectors
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# or select elements as array of DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# или проверете дали елементът отговаря на селектора (от версия 2.5.3)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# create DomQuery from HTML string
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test element existence using CSS selectors
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# find elements as DomQuery array
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test if element matches selector (since version 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# find closest ancestor matching selector (since 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

tester/cs/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@ Pomocné třídy
44

55
DomQuery
66
--------
7-
`Tester\DomQuery` je třída rozšiřující `SimpleXMLElement` o metody usnadňující testování obsahu HTML nebo XML.
7+
`Tester\DomQuery` je třída rozšiřující `SimpleXMLElement` o snadné vyhledávání v HTML nebo XML pomocí CSS selektorů.
88

99
```php
10-
# v $html je řetězec s HTML dokumentem, v $dom získáme kořenový element
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# můžeme testovat přítomnost elementů podle CSS selektorů
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# nebo vybrat elementy jako pole DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# nebo ověřovat, zda element vyhovuje selektoru (od verze 2.5.3)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# vytvoření DomQuery z HTML řetězce
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test existence elementů pomocí CSS selektorů
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# nalezení elementů jako pole DomQuery objektů
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test, zda element odpovídá selektoru (od verze 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# nalezení nejbližšího předka odpovídajícího selektoru (od 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

tester/de/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@ Helfer
44

55
DomQuery
66
--------
7-
`Tester\DomQuery` ist eine Klasse, die `SimpleXMLElement` mit Methoden erweitert, die das Testen von HTML- oder XML-Inhalten erleichtern.
7+
`Tester\DomQuery` erweitert `SimpleXMLElement` um eine einfache HTML- oder XML-Abfrage mit CSS-Selektoren.
88

99
```php
10-
# $html ist ein String mit dem HTML-Dokument, $dom ist das Root-Element.
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# we can test the presence of elements using CSS selectors
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# or select elements as array of DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# oder überprüfen, ob das Element mit dem Selektor übereinstimmt (ab Version 2.5.3)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# create DomQuery from HTML string
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test element existence using CSS selectors
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# find elements as DomQuery array
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test if element matches selector (since version 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# find closest ancestor matching selector (since 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

tester/el/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@
44

55
DomQuery .[#toc-domquery]
66
-------------------------
7-
`Tester\DomQuery` είναι μια κλάση που επεκτείνει το `SimpleXMLElement` με μεθόδους που διευκολύνουν τον έλεγχο περιεχομένου HTML ή XML.
7+
`Tester\DomQuery` επεκτείνει το `SimpleXMLElement` με εύκολη αναζήτηση σε HTML ή XML χρησιμοποιώντας επιλογείς CSS.
88

99
```php
10-
# στο $html είναι μια συμβολοσειρά με το έγγραφο HTML, στο $dom παίρνουμε το στοιχείο ρίζα
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# we can test the presence of elements using CSS selectors
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# or select elements as array of DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# ή να επαληθεύσει ότι το στοιχείο ταιριάζει με τον επιλογέα (από την έκδοση 2.5.3)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# create DomQuery from HTML string
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test element existence using CSS selectors
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# find elements as DomQuery array
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test if element matches selector (since version 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# find closest ancestor matching selector (since 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

tester/en/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@ Helpers
44

55
DomQuery
66
--------
7-
`Tester\DomQuery` is a class that extends `SimpleXMLElement` with methods that make it easier to test HTML or XML content.
7+
`Tester\DomQuery` extends `SimpleXMLElement` with easy HTML or XML querying using CSS selectors.
88

99
```php
10-
# in $html is a string with the HTML document, in $dom we get the root element
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# we can test the presence of elements using CSS selectors
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# or select elements as array of DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# or verify that the element matches the selector (from version 2.5.3)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# create DomQuery from HTML string
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test element existence using CSS selectors
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# find elements as DomQuery array
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test if element matches selector (since version 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# find closest ancestor matching selector (since 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

tester/es/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@ Ayudantes
44

55
DomQuery
66
--------
7-
`Tester\DomQuery` es una clase que amplía `SimpleXMLElement` con métodos que facilitan la comprobación de contenidos HTML o XML.
7+
`Tester\DomQuery` amplía `SimpleXMLElement` con consultas HTML o XML sencillas mediante selectores CSS.
88

99
```php
10-
# en $html es una cadena con el documento HTML, en $dom obtenemos el elemento raíz
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# podemos comprobar la presencia de elementos utilizando selectores CSS
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# o seleccionar elementos como array de DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# o verificar que el elemento coincide con el selector (a partir de la versión 2.5.3)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# create DomQuery from HTML string
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test element existence using CSS selectors
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# find elements as DomQuery array
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test if element matches selector (since version 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# find closest ancestor matching selector (since 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

tester/fr/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@ Aides
44

55
DomQuery
66
--------
7-
`Tester\DomQuery` est une classe qui étend `SimpleXMLElement` avec des méthodes qui facilitent le test du contenu HTML ou XML.
7+
`Tester\DomQuery` étend `SimpleXMLElement` en facilitant les requêtes HTML ou XML à l'aide de sélecteurs CSS.
88

99
```php
10-
# dans $html est une chaîne avec le document HTML, dans $dom nous obtenons l'élément racine
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# we can test the presence of elements using CSS selectors
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# or select elements as array of DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# ou vérifier que l'élément correspond au sélecteur (à partir de la version 2.5.3)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# create DomQuery from HTML string
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test element existence using CSS selectors
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# find elements as DomQuery array
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test if element matches selector (since version 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# find closest ancestor matching selector (since 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

tester/hu/helpers.texy

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@ Segítők
44

55
DomQuery .[#toc-domquery]
66
-------------------------
7-
`Tester\DomQuery` egy olyan osztály, amely a `SimpleXMLElement` címet bővíti olyan metódusokkal, amelyek megkönnyítik a HTML- vagy XML-tartalom tesztelését.
7+
`Tester\DomQuery` kibővíti a `SimpleXMLElement` oldalt egyszerű HTML vagy XML lekérdezéssel CSS szelektorok segítségével.
88

99
```php
10-
# a $html-ben egy karakterlánc a HTML dokumentummal, a $dom-ban pedig a gyökérelemet kapjuk meg.
11-
$dom = Tester\DomQuery::fromHtml($html);
12-
13-
# we can test the presence of elements using CSS selectors
14-
Assert::true($dom->has('form#registration'));
15-
Assert::true($dom->has('input[name="username"]'));
16-
Assert::true($dom->has('input[type="submit"]'));
17-
18-
# or select elements as array of DomQuery
19-
$elems = $dom->find('input[data-autocomplete]');
20-
21-
# vagy ellenőrizze, hogy az elem megfelel-e a szelektornak (a 2.5.3. verziótól)
22-
Assert::true($elems[0]->matches('[type="submit"]'));
10+
# create DomQuery from HTML string
11+
$dom = Tester\DomQuery::fromHtml('
12+
<article class="post">
13+
<h1>Title</h1>
14+
<div class="content">Text</div>
15+
</article>
16+
');
17+
18+
# test element existence using CSS selectors
19+
Assert::true($dom->has('article.post'));
20+
Assert::true($dom->has('h1'));
21+
22+
# find elements as DomQuery array
23+
$headings = $dom->find('h1');
24+
Assert::same('Title', (string) $headings[0]);
25+
26+
# test if element matches selector (since version 2.5.3)
27+
$content = $dom->find('.content')[0];
28+
Assert::true($content->matches('div'));
29+
Assert::false($content->matches('p'));
30+
31+
# find closest ancestor matching selector (since 2.5.5)
32+
$article = $content->closest('.post');
33+
Assert::true($article->matches('article'));
2334
```
2435

2536

0 commit comments

Comments
 (0)