Skip to content

Commit e3089b8

Browse files
committed
feature #55 Rename Panthère to Panther (dunglas)
This PR was merged into the 1.0.x-dev branch. Discussion ---------- Rename Panthère to Panther TODO: * [ ] GitHub * [ ] Packagist * [ ] Travis * [ ] AppVeyor * [ ] SensioLabs Insight Commits ------- 827532f Rename Panthère to Panther
2 parents 1d4ac8c + a85a378 commit e3089b8

33 files changed

+185
-187
lines changed

.php_cs.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
$header = <<<'HEADER'
4-
This file is part of the Panthère project.
4+
This file is part of the Panther project.
55
66
(c) Kévin Dunglas <[email protected]>
77

README.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
<h1 align="center"><img src="panthere.png" alt="Panthère"></h1>
1+
<h1 align="center"><img src="panther.png" alt="Panther"></h1>
22

33
**A browser testing and web scraping library for [PHP](https://php.net) and [Symfony](https://symfony.com)**
44

5-
[![Build Status](https://travis-ci.org/symfony/panthere.svg?branch=master)](https://travis-ci.org/symfony/panthere)
6-
[![Build status](https://ci.appveyor.com/api/projects/status/bunoc4ufud4oie45?svg=true)](https://ci.appveyor.com/project/fabpot/panthere)
5+
[![Build Status](https://travis-ci.org/symfony/panther.svg?branch=master)](https://travis-ci.org/symfony/panther)
6+
[![Build status](https://ci.appveyor.com/api/projects/status/bunoc4ufud4oie45?svg=true)](https://ci.appveyor.com/project/fabpot/panther)
77
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/9ea7e78c-998a-4489-9815-7449ce8291ef/mini.png)](https://insight.sensiolabs.com/projects/9ea7e78c-998a-4489-9815-7449ce8291ef)
88

9-
*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**.
1010

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.
1212

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
1414
[DomCrawler](https://symfony.com/doc/current/components/dom_crawler.html) APIs, and contains
1515
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):
1616
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.
1818

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/)),
2020
so you don't need to install anything on your computer, neither Selenium server nor obscure driver.
2121

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.
2424

2525
## Install
2626

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:
2828

29-
composer req symfony/panthere:dev-master
29+
composer req symfony/panther:dev-master
3030

31-
composer req --dev symfony/panthere:dev-master
31+
composer req --dev symfony/panther:dev-master
3232

3333
## Basic Usage
3434

@@ -37,7 +37,7 @@ Use [Composer](https://getcomposer.org/) to install Panthère in your project. Y
3737

3838
require __DIR__.'/vendor/autoload.php'; // Composer's autoloader
3939

40-
$client = \Symfony\Component\Panthere\Client::createChromeClient();
40+
$client = \Symfony\Component\Panther\Client::createChromeClient();
4141
$crawler = $client->request('GET', 'http://api-platform.com'); // Yes, this website is 100% in JavaScript
4242

4343
$link = $crawler->selectLink('Support')->link();
@@ -52,20 +52,20 @@ $client->takeScreenshot('screen.png'); // Yeah, screenshot!
5252

5353
## Testing Usage
5454

55-
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.
5757
It extends [PHPUnit](https://phpunit.de/)'s `TestCase` and provide all testing tools you're used to.
5858

5959
```php
6060
<?php
6161

62-
use Symfony\Component\Panthere\PanthereTestCase;
62+
use Symfony\Component\Panther\PantherTestCase;
6363

64-
class E2eTest extends PanthereTestCase
64+
class E2eTest extends PantherTestCase
6565
{
6666
public function testMyApp()
6767
{
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
6969
$crawler = $client->request('GET', '/mypage');
7070

7171
$this->assertContains('My Title', $crawler->filter('title')->text()); // You can use any PHPUnit assertion
@@ -79,13 +79,13 @@ To run this test:
7979

8080
### A Polymorph Feline
8181

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
8383
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
8585
it is super-fast!
8686

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
8989
requests, it is fast and is able to browse any webpage, not only the ones of the application under test.
9090
But Goutte doesn't support JavaScript and other advanced features because it is entirely written in PHP.
9191

@@ -96,17 +96,17 @@ to authenticate to an external SSO server, do I want to access the kernel of the
9696
```php
9797
<?php
9898

99-
use Symfony\Component\Panthere\PanthereTestCase;
99+
use Symfony\Component\Panther\PantherTestCase;
100100

101-
class E2eTest extends PanthereTestCase
101+
class E2eTest extends PantherTestCase
102102
{
103103
public function testMyApp()
104104
{
105105
$symfonyClient = static::createClient(); // A cute kitty: the Symfony's functional test too
106106
$goutteClient = static::createGoutteClient(); // An agile lynx: Goutte
107-
$panthereClient = static::createPanthereClient(); // A majestic Panther
107+
$pantherClient = static::createPantherClient(); // A majestic Panther
108108

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
110110

111111
// enjoy the same API for the 3 felines
112112
// $*client->request('GET', '...')
@@ -120,7 +120,7 @@ class E2eTest extends PanthereTestCase
120120

121121
## Features
122122

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:
124124

125125
* executes the JavaScript code contained in webpages
126126
* supports everything that Chrome (or Firefox) implements
@@ -132,39 +132,39 @@ Unlike testing and web scraping libraries you're used to, Panthère:
132132

133133
## Documentation
134134

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:
136136

137137
* For the `Client` class, read [the BrowserKit's documentation](https://symfony.com/doc/current/components/browser_kit.html)
138138
* For the `Crawler` class, read [the DomCrawler's documentation](https://symfony.com/doc/current/components/dom_crawler.html)
139139
* For Webdriver, read [the Facebook's PHP WebDriver documentation](https://github.com/facebook/php-webdriver)
140140

141141
## Environment Variables
142142

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:
144144

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
149149

150150
## Docker Integration
151151

152-
Here is a minimal Docker image that can run Panthère:
152+
Here is a minimal Docker image that can run Panther:
153153

154154
```
155155
FROM php:latest
156156
157157
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
159159
```
160160

161161
Build it with `docker build . -t myproject`
162162
Run it with `docker run -it -v "$PWD":/srv/myproject -w /srv/myproject myproject bin/phpunit`
163163

164164
## Travis CI Integration
165165

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:
168168

169169
```yaml
170170
language: php
@@ -179,8 +179,8 @@ script:
179179
```
180180
## AppVeyor Integration
181181
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`
183+
file to run Panther tests:
184184

185185
```yaml
186186
build: false

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
build: false
22
platform: x86
3-
clone_folder: c:\projects\symfony\panthere
3+
clone_folder: c:\projects\symfony\panther
44

55
cache:
66
- '%LOCALAPPDATA%\Composer\files'

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "symfony/panthere",
2+
"name": "symfony/panther",
33
"type": "library",
44
"description": "A browser testing and web scrapping library for PHP and Symfony.",
55
"keywords": ["scrapping", "E2E", "testing", "webdriver", "selenium", "symfony"],
@@ -26,10 +26,10 @@
2626
"symfony/browser-kit": "4.1.0"
2727
},
2828
"autoload": {
29-
"psr-4": { "Symfony\\Component\\Panthere\\": "src/" }
29+
"psr-4": { "Symfony\\Component\\Panther\\": "src/" }
3030
},
3131
"autoload-dev": {
32-
"psr-4": { "Symfony\\Component\\Panthere\\Tests\\": "tests/" }
32+
"psr-4": { "Symfony\\Component\\Panther\\Tests\\": "tests/" }
3333
},
3434
"extra": {
3535
"branch-alias": {

examples/basic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* This file is part of the Panthère project.
4+
* This file is part of the Panther project.
55
*
66
* (c) Kévin Dunglas <[email protected]>
77
*
@@ -13,7 +13,7 @@
1313

1414
require __DIR__.'/../vendor/autoload.php'; // Composer's autoloader
1515

16-
$client = \Symfony\Component\Panthere\Client::createChromeClient();
16+
$client = \Symfony\Component\Panther\Client::createChromeClient();
1717
$crawler = $client->request('GET', 'http://api-platform.com'); // Yes, this website is 100% in JavaScript
1818

1919
$link = $crawler->selectLink('Support')->link();

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ parameters:
33
# https://github.com/symfony/symfony/pull/27849
44
- '/Parameter #1 \$value of method Symfony\\Component\\DomCrawler\\Field\\ChoiceFormField::select\(\) expects string, array<int, string> given\./'
55
# Require a redesign of the underlying Symfony components
6-
- '#Panthere\\[a-zA-Z\\]+::__construct\(\) does not call parent constructor from Symfony\\Component\\(BrowserKit|DomCrawler)\\[a-zA-Z]+\.#'
6+
- '#Panther\\[a-zA-Z\\]+::__construct\(\) does not call parent constructor from Symfony\\Component\\(BrowserKit|DomCrawler)\\[a-zA-Z]+\.#'

src/Client.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* This file is part of the Panthère project.
4+
* This file is part of the Panther project.
55
*
66
* (c) Kévin Dunglas <[email protected]>
77
*
@@ -11,7 +11,7 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Symfony\Component\Panthere;
14+
namespace Symfony\Component\Panther;
1515

1616
use Facebook\WebDriver\WebDriver;
1717
use Facebook\WebDriver\WebDriverBy;
@@ -22,13 +22,13 @@
2222
use Symfony\Component\BrowserKit\Response;
2323
use Symfony\Component\DomCrawler\Form;
2424
use Symfony\Component\DomCrawler\Link;
25-
use Symfony\Component\Panthere\Cookie\CookieJar;
26-
use Symfony\Component\Panthere\DomCrawler\Crawler;
27-
use Symfony\Component\Panthere\DomCrawler\Form as PanthereForm;
28-
use Symfony\Component\Panthere\DomCrawler\Link as PanthereLink;
29-
use Symfony\Component\Panthere\ProcessManager\BrowserManagerInterface;
30-
use Symfony\Component\Panthere\ProcessManager\ChromeManager;
31-
use Symfony\Component\Panthere\ProcessManager\SeleniumManager;
25+
use Symfony\Component\Panther\Cookie\CookieJar;
26+
use Symfony\Component\Panther\DomCrawler\Crawler;
27+
use Symfony\Component\Panther\DomCrawler\Form as PantherForm;
28+
use Symfony\Component\Panther\DomCrawler\Link as PantherLink;
29+
use Symfony\Component\Panther\ProcessManager\BrowserManagerInterface;
30+
use Symfony\Component\Panther\ProcessManager\ChromeManager;
31+
use Symfony\Component\Panther\ProcessManager\SeleniumManager;
3232

3333
/**
3434
* @author Kévin Dunglas <[email protected]>
@@ -123,7 +123,7 @@ public function getServerParameter($key, $default = '')
123123

124124
public function click(Link $link)
125125
{
126-
if ($link instanceof PanthereLink) {
126+
if ($link instanceof PantherLink) {
127127
$link->getElement()->click();
128128

129129
return $this->crawler = $this->createCrawler();
@@ -134,7 +134,7 @@ public function click(Link $link)
134134

135135
public function submit(Form $form, array $values = [])
136136
{
137-
if ($form instanceof PanthereForm) {
137+
if ($form instanceof PantherForm) {
138138
$button = $form->getButton();
139139
null === $button ? $form->getElement()->submit() : $button->click();
140140

src/Cookie/CookieJar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* This file is part of the Panthère project.
4+
* This file is part of the Panther project.
55
*
66
* (c) Kévin Dunglas <[email protected]>
77
*
@@ -11,14 +11,14 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Symfony\Component\Panthere\Cookie;
14+
namespace Symfony\Component\Panther\Cookie;
1515

1616
use Facebook\WebDriver\Cookie as WebDriverCookie;
1717
use Facebook\WebDriver\WebDriver;
1818
use Symfony\Component\BrowserKit\Cookie;
1919
use Symfony\Component\BrowserKit\CookieJar as BaseCookieJar;
2020
use Symfony\Component\BrowserKit\Response;
21-
use Symfony\Component\Panthere\ExceptionThrower;
21+
use Symfony\Component\Panther\ExceptionThrower;
2222

2323
/**
2424
* @author Kévin Dunglas <[email protected]>

src/DomCrawler/Crawler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* This file is part of the Panthère project.
4+
* This file is part of the Panther project.
55
*
66
* (c) Kévin Dunglas <[email protected]>
77
*
@@ -11,14 +11,14 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Symfony\Component\Panthere\DomCrawler;
14+
namespace Symfony\Component\Panther\DomCrawler;
1515

1616
use Facebook\WebDriver\Exception\NoSuchElementException;
1717
use Facebook\WebDriver\WebDriver;
1818
use Facebook\WebDriver\WebDriverBy;
1919
use Facebook\WebDriver\WebDriverElement;
2020
use Symfony\Component\DomCrawler\Crawler as BaseCrawler;
21-
use Symfony\Component\Panthere\ExceptionThrower;
21+
use Symfony\Component\Panther\ExceptionThrower;
2222

2323
/**
2424
* @author Kévin Dunglas <[email protected]>

src/DomCrawler/Field/ChoiceFormField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* This file is part of the Panthère project.
4+
* This file is part of the Panther project.
55
*
66
* (c) Kévin Dunglas <[email protected]>
77
*
@@ -11,12 +11,12 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Symfony\Component\Panthere\DomCrawler\Field;
14+
namespace Symfony\Component\Panther\DomCrawler\Field;
1515

1616
use Facebook\WebDriver\WebDriverSelect;
1717
use Facebook\WebDriver\WebDriverSelectInterface;
1818
use Symfony\Component\DomCrawler\Field\ChoiceFormField as BaseChoiceFormField;
19-
use Symfony\Component\Panthere\WebDriver\WebDriverCheckbox;
19+
use Symfony\Component\Panther\WebDriver\WebDriverCheckbox;
2020

2121
/**
2222
* @author Kévin Dunglas <[email protected]>

0 commit comments

Comments
 (0)