You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Panthère* is a convenient standalone library to scrape websites and to run end-to-end tests **using real browsers**.
9
+
*Panther* is a convenient standalone library to scrape websites and to run end-to-end tests **using real browsers**.
10
10
11
-
Panthère is super powerful, it leverages [the W3C's WebDriver protocol](https://www.w3.org/TR/webdriver/) to drive native web browsers such as Google Chrome and Firefox.
11
+
Panther is super powerful, it leverages [the W3C's WebDriver protocol](https://www.w3.org/TR/webdriver/) to drive native web browsers such as Google Chrome and Firefox.
12
12
13
-
Panthère is very easy to use, because it implements the popular Symfony's [BrowserKit](https://symfony.com/doc/current/components/browser_kit.html) and
13
+
Panther is very easy to use, because it implements the popular Symfony's [BrowserKit](https://symfony.com/doc/current/components/browser_kit.html) and
14
14
[DomCrawler](https://symfony.com/doc/current/components/dom_crawler.html) APIs, and contains
15
15
all features you need to test your apps. It will sound familiar if you have ever created [a functional test for a Symfony app](https://symfony.com/doc/current/testing.html#functional-tests):
16
16
as the API is exactly the same!
17
-
Keep in mind that Panthère can be used in every PHP project, it's a standalone library.
17
+
Keep in mind that Panther can be used in every PHP project, it's a standalone library.
18
18
19
-
Panthère automatically finds your local installation of Chrome and launches it (thanks to [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/)),
19
+
Panther automatically finds your local installation of Chrome and launches it (thanks to [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/)),
20
20
so you don't need to install anything on your computer, neither Selenium server nor obscure driver.
21
21
22
-
In test mode, Panthère automatically starts your application using [the PHP built-in web-server](http://php.net/manual/en/features.commandline.webserver.php).
23
-
You can just focus on writing your tests or web-scraping scenario, Panthère takes care of everything else.
22
+
In test mode, Panther automatically starts your application using [the PHP built-in web-server](http://php.net/manual/en/features.commandline.webserver.php).
23
+
You can just focus on writing your tests or web-scraping scenario, Panther takes care of everything else.
24
24
25
25
## Install
26
26
27
-
Use [Composer](https://getcomposer.org/) to install Panthère in your project. You may want to use the --dev flag if you want to use Panthere for testing only and not for web scraping:
27
+
Use [Composer](https://getcomposer.org/) to install Panther in your project. You may want to use the --dev flag if you want to use Panther for testing only and not for web scraping:
28
28
29
-
composer req symfony/panthere:dev-master
29
+
composer req symfony/panther:dev-master
30
30
31
-
composer req --dev symfony/panthere:dev-master
31
+
composer req --dev symfony/panther:dev-master
32
32
33
33
## Basic Usage
34
34
@@ -37,7 +37,7 @@ Use [Composer](https://getcomposer.org/) to install Panthère in your project. Y
The `PanthereTestCase` class allows you to easily write E2E tests. It automatically starts your app using the built-in PHP
56
-
web server and let you crawl it using Panthère.
55
+
The `PantherTestCase` class allows you to easily write E2E tests. It automatically starts your app using the built-in PHP
56
+
web server and let you crawl it using Panther.
57
57
It extends [PHPUnit](https://phpunit.de/)'s `TestCase` and provide all testing tools you're used to.
58
58
59
59
```php
60
60
<?php
61
61
62
-
use Symfony\Component\Panthere\PanthereTestCase;
62
+
use Symfony\Component\Panther\PantherTestCase;
63
63
64
-
class E2eTest extends PanthereTestCase
64
+
class E2eTest extends PantherTestCase
65
65
{
66
66
public function testMyApp()
67
67
{
68
-
$client = static::createPanthereClient(); // Your app is automatically started using the built-in web server
68
+
$client = static::createPantherClient(); // Your app is automatically started using the built-in web server
69
69
$crawler = $client->request('GET', '/mypage');
70
70
71
71
$this->assertContains('My Title', $crawler->filter('title')->text()); // You can use any PHPUnit assertion
@@ -79,13 +79,13 @@ To run this test:
79
79
80
80
### A Polymorph Feline
81
81
82
-
If you are testing a Symfony application, `PanthereTestCase` automatically extends the `WebTestCase` class. It means
82
+
If you are testing a Symfony application, `PantherTestCase` automatically extends the `WebTestCase` class. It means
83
83
you can easily create functional tests, which can directly execute the kernel of your application and access all your existing
84
-
services. Unlike the Panthère's client, the Symfony's testing client doesn't support JavaScript and screenshots capturing, but
84
+
services. Unlike the Panther's client, the Symfony's testing client doesn't support JavaScript and screenshots capturing, but
85
85
it is super-fast!
86
86
87
-
Alternatively (and even for non-Symfony apps), Panthère can also leverage the [Goutte](https://github.com/FriendsOfPHP/Goutte)
88
-
web scraping library, which is an intermediate between the Symfony's and the Panthère's test clients. Goutte sends real HTTP
87
+
Alternatively (and even for non-Symfony apps), Panther can also leverage the [Goutte](https://github.com/FriendsOfPHP/Goutte)
88
+
web scraping library, which is an intermediate between the Symfony's and the Panther's test clients. Goutte sends real HTTP
89
89
requests, it is fast and is able to browse any webpage, not only the ones of the application under test.
90
90
But Goutte doesn't support JavaScript and other advanced features because it is entirely written in PHP.
91
91
@@ -96,17 +96,17 @@ to authenticate to an external SSO server, do I want to access the kernel of the
96
96
```php
97
97
<?php
98
98
99
-
use Symfony\Component\Panthere\PanthereTestCase;
99
+
use Symfony\Component\Panther\PantherTestCase;
100
100
101
-
class E2eTest extends PanthereTestCase
101
+
class E2eTest extends PantherTestCase
102
102
{
103
103
public function testMyApp()
104
104
{
105
105
$symfonyClient = static::createClient(); // A cute kitty: the Symfony's functional test too
106
106
$goutteClient = static::createGoutteClient(); // An agile lynx: Goutte
107
-
$panthereClient = static::createPanthereClient(); // A majestic Panther
107
+
$pantherClient = static::createPantherClient(); // A majestic Panther
108
108
109
-
// Both Goutte and Panthère benefits from the built-in HTTP server
109
+
// Both Goutte and Panther benefits from the built-in HTTP server
110
110
111
111
// enjoy the same API for the 3 felines
112
112
// $*client->request('GET', '...')
@@ -120,7 +120,7 @@ class E2eTest extends PanthereTestCase
120
120
121
121
## Features
122
122
123
-
Unlike testing and web scraping libraries you're used to, Panthère:
123
+
Unlike testing and web scraping libraries you're used to, Panther:
124
124
125
125
* executes the JavaScript code contained in webpages
126
126
* supports everything that Chrome (or Firefox) implements
@@ -132,39 +132,39 @@ Unlike testing and web scraping libraries you're used to, Panthère:
132
132
133
133
## Documentation
134
134
135
-
Since Panthère implements the API of popular, it already has an extensive documentation:
135
+
Since Panther implements the API of popular libraries, it already has an extensive documentation:
136
136
137
137
* For the `Client` class, read [the BrowserKit's documentation](https://symfony.com/doc/current/components/browser_kit.html)
138
138
* For the `Crawler` class, read [the DomCrawler's documentation](https://symfony.com/doc/current/components/dom_crawler.html)
139
139
* For Webdriver, read [the Facebook's PHP WebDriver documentation](https://github.com/facebook/php-webdriver)
140
140
141
141
## Environment Variables
142
142
143
-
The following environment variables can be set to change some Panthère behaviors:
143
+
The following environment variables can be set to change some Panther behaviors:
144
144
145
-
*`PANTHERE_NO_HEADLESS`: to disable browsers's headless mode (will display the testing window, useful to debug)
146
-
*`PANTHERE_NO_SANDBOX`: to disable [Chrome's sandboxing](https://chromium.googlesource.com/chromium/src/+/b4730a0c2773d8f6728946013eb812c6d3975bec/docs/design/sandbox.md) (unsafe, but allows to use Panthère in containers)
147
-
*`PANTHERE_WEB_SERVER_DIR`: to change the project's document root (default to `public/`)
148
-
*`PANTHERE_CHROME_DRIVER_BINARY`: to use another `chromedriver` binary, instead of relying on the ones already provided by Panthère
145
+
*`PANTHER_NO_HEADLESS`: to disable browsers's headless mode (will display the testing window, useful to debug)
146
+
*`PANTHER_NO_SANDBOX`: to disable [Chrome's sandboxing](https://chromium.googlesource.com/chromium/src/+/b4730a0c2773d8f6728946013eb812c6d3975bec/docs/design/sandbox.md) (unsafe, but allows to use Panther in containers)
147
+
*`PANTHER_WEB_SERVER_DIR`: to change the project's document root (default to `public/`)
148
+
*`PANTHER_CHROME_DRIVER_BINARY`: to use another `chromedriver` binary, instead of relying on the ones already provided by Panther
149
149
150
150
## Docker Integration
151
151
152
-
Here is a minimal Docker image that can run Panthère:
152
+
Here is a minimal Docker image that can run Panther:
153
153
154
154
```
155
155
FROM php:latest
156
156
157
157
RUN apt-get update && apt-get install -y zlib1g-dev chromium && docker-php-ext-install zip
158
-
ENV PANTHERE_NO_SANDBOX 1
158
+
ENV PANTHER_NO_SANDBOX 1
159
159
```
160
160
161
161
Build it with `docker build . -t myproject`
162
162
Run it with `docker run -it -v "$PWD":/srv/myproject -w /srv/myproject myproject bin/phpunit`
163
163
164
164
## Travis CI Integration
165
165
166
-
Panthère will work out of the box with Travis if you add the Chrome addon. Here is a minimal `.travis.yml` file to run
167
-
Panthère tests:
166
+
Panther will work out of the box with Travis if you add the Chrome addon. Here is a minimal `.travis.yml` file to run
167
+
Panther tests:
168
168
169
169
```yaml
170
170
language: php
@@ -179,8 +179,8 @@ script:
179
179
```
180
180
## AppVeyor Integration
181
181
182
-
Panthère will work out of the box with AppVeyor as long as Google Chrome is installed. Here is a minimal `appveyor.yml`
183
-
file to run Panthère tests:
182
+
Panther will work out of the box with AppVeyor as long as Google Chrome is installed. Here is a minimal `appveyor.yml`
0 commit comments