PHPackages                             spinen/spinen-php-web-tester - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. spinen/spinen-php-web-tester

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

spinen/spinen-php-web-tester
============================

Simple Tester for PHP web sites.

0.1.2(9y ago)0209MITPHPPHP &gt;=5.6.0

Since Sep 13Pushed 9y ago3 watchersCompare

[ Source](https://github.com/spinen/simple-php-web-tester)[ Packagist](https://packagist.org/packages/spinen/spinen-php-web-tester)[ RSS](/packages/spinen-spinen-php-web-tester/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (8)Versions (7)Used By (0)

Simple Tester for PHP web sites
===============================

[](#simple-tester-for-php-web-sites)

We were wanting a testing framework very similar to Laravel's to run acceptance-like tests on basic php sites. This was built to help a college class learn about TDD in a dynamic content class. We wanted to use Laravel's constraints that are in the Foundation section, but they no longer subsplit that code out into a read-only Illuminate repository. We are requiring the Laravel Framework just to get the constraints, but it's going to pull in many packages. Therefore, only require this package in the dev section.

Credits
-------

[](#credits)

There are huge sections of the code that is in `PageAssertions` class that is a complete copy &amp; paste from Laravel's `InteractsWithPages` class. We would have just used the class, but it relies too much on booting Laravel, so we wrote our own class &amp; just pulled over the assertions that we could reuse.

Installation
------------

[](#installation)

```
composer require --dev spinen/spinen-php-web-tester

```

Usage
-----

[](#usage)

You can either extend an abstract class that we provide or use the traits that provides the functionality.

1. Extend `Spinen\SimplePhpTester\TestCase` so that you will have access to the test.
2. Mixin the test by `use`ing `Spinen\SimplePhpTester\Browser` and `Spinen\SimplePhpTester\PageAssertions` in your testfile.

Configuration
-------------

[](#configuration)

The test assumes that your web files are in a directory named `public`. If that is not the case, then you have 3 options...

1. Add a protected property to your test class named `$web_root` with the name of the directory (i.e. `protected $web_root = 'web';`).
2. Call `setWebRoot` with the directory relative to the directory that you are running phpunit (i.e. `$this->setWebRoot('web');`).
3. Add a protected method to your test class named `determinedFullPath` that builds the full path to the directory of the script being tested.

Assertions
----------

[](#assertions)

Here is a list of the assertions that are provided...

- assertPageLoaded
- dontSee
- dontSeeElement
- dontSeeInElement
- dontSeeInField
- dontSeeIsChecked
- dontSeeIsSelected
- dontSeeLink
- dontSeeText
- see
- seeElement
- seeInElement
- seeInField
- seeIsChecked
- seeIsSelected
- seeLink
- seeText

Example Test
------------

[](#example-test)

```
