| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| <phpunit bootstrap="tests/phpunit/bootstrap.php" backupGlobals="false" colors="true"> | ||
| <testsuites> | ||
| <!-- Default test suite to run all tests --> | ||
| <testsuite> | ||
| <directory prefix="test." suffix=".php">tests/phpunit/</directory> | ||
| </testsuite> | ||
| </testsuites> | ||
| </phpunit> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <IfModule mod_php5.c> | ||
| AddType application/x-httpd-php .php .phtml .php5 | ||
| AddType application/x-httpd-php-source .phps | ||
| </IfModule> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| LoadModule php5_module /usr/lib/apache2/modules/libphp5.so |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| phantomjs --webdriver=4444 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <VirtualHost *:80> | ||
| ServerAdmin tests@inboundnow.com | ||
| DocumentRoot /var/www/inboundtesting.dev/ | ||
| ServerName inboundtesting.dev | ||
| ErrorLog ${APACHE_LOG_DIR}/error.log | ||
| CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
|
|
||
| # Wire up Apache to use Travis CI's php-fpm. | ||
| <IfModule mod_fastcgi.c> | ||
| AddHandler php5-fcgi .php | ||
| Action php5-fcgi /php5-fcgi | ||
| Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi | ||
| FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization | ||
| </IfModule> | ||
|
|
||
| <Directory "/var/www/inboundtesting.dev/"> | ||
| Options FollowSymLinks MultiViews ExecCGI | ||
| AllowOverride All | ||
| Order deny,allow | ||
| Allow from all | ||
| </Directory> | ||
| </VirtualHost> | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?php | ||
|
|
||
| /* load wp */ | ||
| require '../../../wp-load.php'; | ||
| require '../../../wp-admin/includes/plugin.php'; | ||
|
|
||
| /* load required landing pages files */ | ||
| include_once LANDINGPAGES_PATH . 'modules/module.install.php'; | ||
| include_once LANDINGPAGES_PATH . 'classes/class.statistics.php'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /* Replace this file with actual dump of your database */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?php | ||
| namespace Codeception\Module; | ||
|
|
||
| // here you can define custom actions | ||
| // all public methods declared in helper class will be available in $I | ||
|
|
||
| class AcceptanceHelper extends \Codeception\Module | ||
| { | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?php | ||
| namespace Codeception\Module; | ||
|
|
||
| // here you can define custom actions | ||
| // all public methods declared in helper class will be available in $I | ||
|
|
||
| class FunctionalHelper extends \Codeception\Module | ||
| { | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?php | ||
| namespace Codeception\Module; | ||
|
|
||
| // here you can define custom actions | ||
| // all public methods declared in helper class will be available in $I | ||
|
|
||
| class UnitHelper extends \Codeception\Module | ||
| { | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Codeception Test Suite Configuration | ||
|
|
||
| # suite for acceptance tests. | ||
| # perform tests in browser using the WebDriver or PhpBrowser. | ||
| # If you need both WebDriver and PHPBrowser tests - create a separate suite. | ||
|
|
||
| class_name: AcceptanceTester | ||
| modules: | ||
| enabled: | ||
| - WebDriver | ||
| - AcceptanceHelper | ||
| - Asserts | ||
| config: | ||
| WebDriver: | ||
| url: 'http://local.wordpress.dev/' | ||
| browser: firefox | ||
| clear_cookies: false | ||
| window_size: 1024x768 | ||
| PhpBrowser: | ||
| url: 'http://inboundsoon.dev' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?php | ||
| $I = new AcceptanceTester($scenario); | ||
| $I->wantTo('login to wp-admin'); | ||
| $I->amOnPage( site_url().'/wp-login.php' ); | ||
| $I->fillField('Username', 'admin'); | ||
| $I->fillField('Password','admin'); | ||
| $I->click('Log In'); | ||
| $I->see('Dashboard'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * This test is desnged to test the impressions/conversions systems of landing pages. | ||
| * Systems tested: | ||
| * - Dmummy landing page creation | ||
| * - Impression/Conversion UI display on landing page edit screen | ||
| * - Cear individual landing page stats buttons. | ||
| * - Manually setting impressions/conversions | ||
| * - Makes sure landing page does not 404 | ||
| * - Frontend impression ajax systems | ||
| * - Variation rotation systems | ||
| * - Conversion tracking system for inbount form | ||
| * - Conversion tracking system for tracked link | ||
| */ | ||
|
|
||
| /* create test landing page */ | ||
| $lp_id = inbound_install_example_lander(); | ||
| shell_exec('here'); | ||
| shell_exec($lp_id); | ||
| $permalink = get_post_permalink( $lp_id , false ); | ||
| shell_exec($permalink); | ||
| $I = new AcceptanceTester($scenario); | ||
|
|
||
|
|
||
| $I->wantTo('check example landing page is editable'); | ||
| $I->amOnPage( admin_url( 'post.php?post='. $lp_id .'&action=edit&frontend=false') ); | ||
| $I->seeInField( '#title','A/B Testing Landing Page Example'); | ||
|
|
||
| $I->wantTo('check if impressions are correct for variation a'); | ||
| $imp = $I->grabTextFrom('#lp-variation-A .bab-stat-span-impressions'); | ||
| $I->assertContains( '30' , $imp ); | ||
|
|
||
| $I->wantTo('check check impressions for variation b'); | ||
| $imp = $I->grabTextFrom('#lp-variation-B .bab-stat-span-impressions'); | ||
| $I->assertContains( '35' , $imp , '' ); | ||
|
|
||
| $I->wantTo('check conversions for variation a'); | ||
| $con = $I->grabTextFrom('#lp-variation-A .bab-stat-span-conversions'); | ||
| $I->assertContains( '10' , $con , '' ); | ||
|
|
||
| $I->wantTo('check conversions for variation b'); | ||
| $con = $I->grabTextFrom('#lp-variation-B .bab-stat-span-conversions'); | ||
| $I->assertContains( '15' , $con ); | ||
|
|
||
| $I->wantTo('check the conversion rate of variation a'); | ||
| $per = $I->grabTextFrom('#lp-variation-A .bab-stat-span-conversion_rate'); | ||
| $I->assertContains( '33' , $per ); | ||
|
|
||
| $I->wantTo('check the conversion rate of variation b'); | ||
| $per = $I->grabTextFrom('#lp-variation-B .bab-stat-span-conversion_rate'); | ||
| $I->assertContains( '43' , $per ); | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
|
|
||
| $I = new AcceptanceTester($scenario); | ||
| $I->wantTo('Make sure the default WordPress homepage loads.'); | ||
| $I->amOnPage( site_url() ); | ||
| $I->see('Hello world!'); | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| <?php | ||
| // Here you can initialize variables that will be available to your tests |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Codeception Test Suite Configuration | ||
|
|
||
| # suite for functional (integration) tests. | ||
| # emulate web requests and make application process them. | ||
| # Include one of framework modules (Symfony2, Yii2, Laravel4) to use it. | ||
|
|
||
| class_name: FunctionalTester | ||
| modules: | ||
| enabled: [Filesystem, FunctionalHelper] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,360 @@ | ||
| <?php //[STAMP] fa259e6277a310881c0cdeb89563ce4c | ||
|
|
||
| // This class was automatically generated by build task | ||
| // You should not change it manually as it will be overwritten on next build | ||
| // @codingStandardsIgnoreFile | ||
|
|
||
|
|
||
| use Codeception\Module\Filesystem; | ||
| use Codeception\Module\FunctionalHelper; | ||
|
|
||
| /** | ||
| * Inherited Methods | ||
| * @method void wantToTest($text) | ||
| * @method void wantTo($text) | ||
| * @method void execute($callable) | ||
| * @method void expectTo($prediction) | ||
| * @method void expect($prediction) | ||
| * @method void amGoingTo($argumentation) | ||
| * @method void am($role) | ||
| * @method void lookForwardTo($achieveValue) | ||
| * @method void comment($description) | ||
| * @method void haveFriend($name, $actorClass = null) | ||
| * | ||
| * @SuppressWarnings(PHPMD) | ||
| */ | ||
| class FunctionalTester extends \Codeception\Actor | ||
| { | ||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Enters a directory In local filesystem. | ||
| * Project root directory is used by default | ||
| * | ||
| * @param $path | ||
| * @see \Codeception\Module\Filesystem::amInPath() | ||
| */ | ||
| public function amInPath($path) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Condition('amInPath', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Opens a file and stores it's content. | ||
| * | ||
| * Usage: | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->openFile('composer.json'); | ||
| * $I->seeInThisFile('codeception/codeception'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $filename | ||
| * @see \Codeception\Module\Filesystem::openFile() | ||
| */ | ||
| public function openFile($filename) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('openFile', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Deletes a file | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->deleteFile('composer.lock'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $filename | ||
| * @see \Codeception\Module\Filesystem::deleteFile() | ||
| */ | ||
| public function deleteFile($filename) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('deleteFile', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Deletes directory with all subdirectories | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->deleteDir('vendor'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $dirname | ||
| * @see \Codeception\Module\Filesystem::deleteDir() | ||
| */ | ||
| public function deleteDir($dirname) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('deleteDir', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Copies directory with all contents | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->copyDir('vendor','old_vendor'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $src | ||
| * @param $dst | ||
| * @see \Codeception\Module\Filesystem::copyDir() | ||
| */ | ||
| public function copyDir($src, $dst) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('copyDir', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks If opened file has `text` in it. | ||
| * | ||
| * Usage: | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->openFile('composer.json'); | ||
| * $I->seeInThisFile('codeception/codeception'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $text | ||
| * Conditional Assertion: Test won't be stopped on fail | ||
| * @see \Codeception\Module\Filesystem::seeInThisFile() | ||
| */ | ||
| public function canSeeInThisFile($text) { | ||
| return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args())); | ||
| } | ||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks If opened file has `text` in it. | ||
| * | ||
| * Usage: | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->openFile('composer.json'); | ||
| * $I->seeInThisFile('codeception/codeception'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $text | ||
| * @see \Codeception\Module\Filesystem::seeInThisFile() | ||
| */ | ||
| public function seeInThisFile($text) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks the strict matching of file contents. | ||
| * Unlike `seeInThisFile` will fail if file has something more than expected lines. | ||
| * Better to use with HEREDOC strings. | ||
| * Matching is done after removing "\r" chars from file content. | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->openFile('process.pid'); | ||
| * $I->seeFileContentsEqual('3192'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $text | ||
| * Conditional Assertion: Test won't be stopped on fail | ||
| * @see \Codeception\Module\Filesystem::seeFileContentsEqual() | ||
| */ | ||
| public function canSeeFileContentsEqual($text) { | ||
| return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args())); | ||
| } | ||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks the strict matching of file contents. | ||
| * Unlike `seeInThisFile` will fail if file has something more than expected lines. | ||
| * Better to use with HEREDOC strings. | ||
| * Matching is done after removing "\r" chars from file content. | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->openFile('process.pid'); | ||
| * $I->seeFileContentsEqual('3192'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $text | ||
| * @see \Codeception\Module\Filesystem::seeFileContentsEqual() | ||
| */ | ||
| public function seeFileContentsEqual($text) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks If opened file doesn't contain `text` in it | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->openFile('composer.json'); | ||
| * $I->dontSeeInThisFile('codeception/codeception'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $text | ||
| * Conditional Assertion: Test won't be stopped on fail | ||
| * @see \Codeception\Module\Filesystem::dontSeeInThisFile() | ||
| */ | ||
| public function cantSeeInThisFile($text) { | ||
| return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args())); | ||
| } | ||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks If opened file doesn't contain `text` in it | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->openFile('composer.json'); | ||
| * $I->dontSeeInThisFile('codeception/codeception'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $text | ||
| * @see \Codeception\Module\Filesystem::dontSeeInThisFile() | ||
| */ | ||
| public function dontSeeInThisFile($text) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Deletes a file | ||
| * @see \Codeception\Module\Filesystem::deleteThisFile() | ||
| */ | ||
| public function deleteThisFile() { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('deleteThisFile', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks if file exists in path. | ||
| * Opens a file when it's exists | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->seeFileFound('UserModel.php','app/models'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $filename | ||
| * @param string $path | ||
| * Conditional Assertion: Test won't be stopped on fail | ||
| * @see \Codeception\Module\Filesystem::seeFileFound() | ||
| */ | ||
| public function canSeeFileFound($filename, $path = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args())); | ||
| } | ||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks if file exists in path. | ||
| * Opens a file when it's exists | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->seeFileFound('UserModel.php','app/models'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $filename | ||
| * @param string $path | ||
| * @see \Codeception\Module\Filesystem::seeFileFound() | ||
| */ | ||
| public function seeFileFound($filename, $path = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks if file does not exists in path | ||
| * | ||
| * @param $filename | ||
| * @param string $path | ||
| * Conditional Assertion: Test won't be stopped on fail | ||
| * @see \Codeception\Module\Filesystem::dontSeeFileFound() | ||
| */ | ||
| public function cantSeeFileFound($filename, $path = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeFileFound', func_get_args())); | ||
| } | ||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks if file does not exists in path | ||
| * | ||
| * @param $filename | ||
| * @param string $path | ||
| * @see \Codeception\Module\Filesystem::dontSeeFileFound() | ||
| */ | ||
| public function dontSeeFileFound($filename, $path = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeFileFound', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Erases directory contents | ||
| * | ||
| * ``` php | ||
| * <?php | ||
| * $I->cleanDir('logs'); | ||
| * ?> | ||
| * ``` | ||
| * | ||
| * @param $dirname | ||
| * @see \Codeception\Module\Filesystem::cleanDir() | ||
| */ | ||
| public function cleanDir($dirname) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('cleanDir', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Saves contents to file | ||
| * | ||
| * @param $filename | ||
| * @param $contents | ||
| * @see \Codeception\Module\Filesystem::writeToFile() | ||
| */ | ||
| public function writeToFile($filename, $contents) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('writeToFile', func_get_args())); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| <?php | ||
| // Here you can initialize variables that will be available to your tests |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Codeception Test Suite Configuration | ||
|
|
||
| # suite for unit (internal) tests. | ||
| class_name: UnitTester | ||
| modules: | ||
| enabled: [Asserts, UnitHelper] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,300 @@ | ||
| <?php //[STAMP] c8568e8eab4a240544c36ae031f88bd8 | ||
|
|
||
| // This class was automatically generated by build task | ||
| // You should not change it manually as it will be overwritten on next build | ||
| // @codingStandardsIgnoreFile | ||
|
|
||
|
|
||
| use Codeception\Module\Asserts; | ||
| use Codeception\Module\UnitHelper; | ||
|
|
||
| /** | ||
| * Inherited Methods | ||
| * @method void wantToTest($text) | ||
| * @method void wantTo($text) | ||
| * @method void execute($callable) | ||
| * @method void expectTo($prediction) | ||
| * @method void expect($prediction) | ||
| * @method void amGoingTo($argumentation) | ||
| * @method void am($role) | ||
| * @method void lookForwardTo($achieveValue) | ||
| * @method void comment($description) | ||
| * @method void haveFriend($name, $actorClass = null) | ||
| * | ||
| * @SuppressWarnings(PHPMD) | ||
| */ | ||
| class UnitTester extends \Codeception\Actor | ||
| { | ||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that two variables are equal. | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * | ||
| * @return mixed | ||
| * @see \Codeception\Module\Asserts::assertEquals() | ||
| */ | ||
| public function assertEquals($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that two variables are not equal | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertNotEquals() | ||
| */ | ||
| public function assertNotEquals($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that two variables are same | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * | ||
| * @return mixed | ||
| * @see \Codeception\Module\Asserts::assertSame() | ||
| */ | ||
| public function assertSame($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that two variables are not same | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertNotSame() | ||
| */ | ||
| public function assertNotSame($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that expected is greater than actual | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertGreaterThan() | ||
| */ | ||
| public function assertGreaterThan($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * @deprecated | ||
| * @see \Codeception\Module\Asserts::assertGreaterThen() | ||
| */ | ||
| public function assertGreaterThen($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that expected is greater or equal than actual | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() | ||
| */ | ||
| public function assertGreaterThanOrEqual($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * @deprecated | ||
| * @see \Codeception\Module\Asserts::assertGreaterThenOrEqual() | ||
| */ | ||
| public function assertGreaterThenOrEqual($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that expected is less than actual | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertLessThan() | ||
| */ | ||
| public function assertLessThan($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that expected is less or equal than actual | ||
| * | ||
| * @param $expected | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertLessThanOrEqual() | ||
| */ | ||
| public function assertLessThanOrEqual($expected, $actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that haystack contains needle | ||
| * | ||
| * @param $needle | ||
| * @param $haystack | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertContains() | ||
| */ | ||
| public function assertContains($needle, $haystack, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that haystack doesn't contain needle. | ||
| * | ||
| * @param $needle | ||
| * @param $haystack | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertNotContains() | ||
| */ | ||
| public function assertNotContains($needle, $haystack, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that variable is empty. | ||
| * | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertEmpty() | ||
| */ | ||
| public function assertEmpty($actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that variable is not empty. | ||
| * | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertNotEmpty() | ||
| */ | ||
| public function assertNotEmpty($actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that variable is NULL | ||
| * | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertNull() | ||
| */ | ||
| public function assertNull($actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that variable is not NULL | ||
| * | ||
| * @param $actual | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertNotNull() | ||
| */ | ||
| public function assertNotNull($actual, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that condition is positive. | ||
| * | ||
| * @param $condition | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertTrue() | ||
| */ | ||
| public function assertTrue($condition, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Checks that condition is negative. | ||
| * | ||
| * @param $condition | ||
| * @param string $message | ||
| * @see \Codeception\Module\Asserts::assertFalse() | ||
| */ | ||
| public function assertFalse($condition, $message = null) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * [!] Method is generated. Documentation taken from corresponding module. | ||
| * | ||
| * Fails the test with message. | ||
| * | ||
| * @param $message | ||
| * @see \Codeception\Module\Asserts::fail() | ||
| */ | ||
| public function fail($message) { | ||
| return $this->scenario->runStep(new \Codeception\Step\Action('fail', func_get_args())); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| <?php | ||
| // Here you can initialize variables that will be available to your tests |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /** | ||
| * PhantomJs server for calling webpages & processing JS | ||
| * returns page content | ||
| */ | ||
|
|
||
| var args = require('system').args; | ||
| var address = args[1]; | ||
| var page = new WebPage(); | ||
|
|
||
| var renderPage = function(){ | ||
|
|
||
| page = require('webpage').create(); | ||
| var myArgs = Array.prototype.slice.call(arguments), | ||
| url_str = myArgs[0]; | ||
|
|
||
| console.log('accessing:'+url_str); | ||
|
|
||
| page.onError = function(msg){console.log('js error');} | ||
|
|
||
| /** | ||
| * From PhantomJS documentation: | ||
| * This callback is invoked when there is a JavaScript console. The callback may accept up to three arguments: | ||
| * the string for the message, the line number, and the source identifier. | ||
| */ | ||
| page.onConsoleMessage = function (msg, line, source) { | ||
| console.log('console> ' + msg); | ||
| }; | ||
|
|
||
| /** | ||
| * From PhantomJS documentation: | ||
| * This callback is invoked when there is a JavaScript alert. The only argument passed to the callback is the string for the message. | ||
| */ | ||
| page.onAlert = function (msg) { | ||
| console.log('alert!!> ' + msg); | ||
| }; | ||
|
|
||
| /** | ||
| * Handle Redirection | ||
| */ | ||
| page.onNavigationRequested = function(url_sub_str, type, willNavigate, main) { | ||
| if (main && url_sub_str != url_str) { | ||
| url_str = url_sub_str; | ||
| console.log("redirect caught"); | ||
| page.close(); | ||
| setTimeout(function() { | ||
| renderPage(url_str) | ||
| },1); | ||
| } | ||
| }; | ||
|
|
||
| page.onResourceReceived = function (response) { | ||
| //console.log('Receive ' + JSON.stringify(response, undefined, 4)); | ||
| }; | ||
|
|
||
| //page.onLoadFinished = function() { console.log("onLoadFinished FIRED"); } | ||
|
|
||
| /** | ||
| * Open the web page and run RRunner | ||
| */ | ||
| page.open(url_str, function(status) { | ||
| console.log('here'); | ||
| if (status === 'success') { | ||
| console.log(page.content); | ||
| page.close(); | ||
| setTimeout( function() { | ||
|
|
||
| phantom.exit(); | ||
| } , 5000); | ||
| } else { | ||
| console.log('failed'); | ||
| phantom.exit(); | ||
| } | ||
| }); | ||
| }; | ||
|
|
||
|
|
||
| address = 'http://local.wordpress.dev/test.php'; | ||
| //address = 'http://local.wordpress.dev/'; | ||
| //address = 'http://www.simpleweb.org/'; | ||
| renderPage(address); | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?php | ||
| //echo shell_exec( '/usr/bin/phantomjs /vagrant/www/wordpress-default/wp-content/plugins/landing-pages/tests/phantomjs/server.js' ); | ||
| //sleep(10); | ||
|
|
||
| //$output = shell_exec('/usr/bin/phantomjs server.js'); | ||
| //echo "<pre>$output</pre>"; | ||
| error_reporting(E_ALL); | ||
| session_write_close(); | ||
| $result = shell_exec('phantomjs --web-security=false --ssl-protocol=any server.js ' . $_GET['url'] ); | ||
| echo $result; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/sh | ||
| export DISPLAY=:0 | ||
| phantomjs --ignore-ssl-errors=true server.js 2>&1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?php | ||
| /** | ||
| * Bootstrap the plugin unit testing environment. | ||
| * | ||
| * @package wordpress-plugin-tests | ||
| */ | ||
|
|
||
| /* load wp environemnt */ | ||
| require '../../../wp-load.php'; | ||
|
|
||
| /* load plugins */ | ||
| require '../../../wp-admin/includes/plugin.php'; | ||
|
|
||
| /** | ||
| * Replacement for wp_remote_get | ||
| * processes javascript through PhantomJs | ||
| */ | ||
| function inbound_remote_get( $url ) { | ||
| $response = wp_remote_get( | ||
| add_query_arg( | ||
| array( 'url' => urlencode( $url ) ) , | ||
| LANDINGPAGES_URLPATH . 'tests/phantomjs/server.php' | ||
| ) | ||
| ); | ||
|
|
||
| return $response; | ||
| } | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Tests to test that that testing framework is testing tests. Meta, huh? | ||
| * | ||
| * @package wordpress-plugins-tests | ||
| */ | ||
| class Tests_Activation extends PHPUnit_Framework_TestCase { | ||
|
|
||
| /** | ||
| * Run a simple test to ensure that the tests are running | ||
| */ | ||
| function test_tests() { | ||
| $this->assertTrue( true ); | ||
| } | ||
|
|
||
| /** | ||
| * Ensure landing pages is active | ||
| */ | ||
| function test_lading_pages_activated() { | ||
| $this->assertTrue( is_plugin_active( 'landing-pages/landing-pages.php' ) ); | ||
| } | ||
|
|
||
| /** | ||
| * Ensure that the Leads has been installed and activated. | ||
| */ | ||
| function test_leads_activated() { | ||
| $this->assertTrue( is_plugin_active( 'leads/leads.php' ) ); | ||
| } | ||
|
|
||
| /** | ||
| * Ensure that the Calls to Action has been installed and activated. | ||
| */ | ||
| function test_cta_activated() { | ||
| $this->assertTrue( is_plugin_active( 'cta/calls-to-action.php' ) ); | ||
| } | ||
|
|
||
| /** | ||
| * Run upgrade routines and check option to see if complete | ||
| */ | ||
| function test_run_upgrade_routines() { | ||
| include_once LANDINGPAGES_PATH . 'classes/class.activation.php'; | ||
| include_once LANDINGPAGES_PATH . 'classes/class.activation.upgrade-routines.php'; | ||
| Landing_Pages_Activation::run_updates(); | ||
| $this->assertTrue( true ); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| ?> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Test design to juse phantomjs to interact with front end. This test is disabled in favor for codeception tests | ||
| * | ||
| * @package wordpress-plugins-tests | ||
| */ | ||
| class Tests_Statistics extends PHPUnit_Framework_TestCase { | ||
|
|
||
| var $lp_id; | ||
| var $variations; | ||
|
|
||
| /** | ||
| * setup | ||
| */ | ||
| function setUp() { | ||
| return; | ||
| /* includes */ | ||
| include_once LANDINGPAGES_PATH . 'modules/module.install.php'; | ||
| include_once LANDINGPAGES_PATH . 'classes/class.statistics.php'; | ||
|
|
||
| $this->lp_id = inbound_install_example_lander(); | ||
| /* clear the stats */ | ||
| $this->variations = Landing_Pages_Statistics::get_variations($this->lp_id ); | ||
| foreach ($this->variations as $vid) { | ||
| Landing_Pages_Statistics::set_impression_count( $this->lp_id , $vid, 0 ); | ||
| Landing_Pages_Statistics::set_conversion_count( $this->lp_id , $vid, 0 ); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Tear down | ||
| */ | ||
| function tearDown() { | ||
| return; | ||
| //delete_option('lp_settings_general'); | ||
| //wp_delete_post( $this->lp_id , false ); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Test is Landing_Pages_Statistics::read_statistics works | ||
| */ | ||
| function test_read_statistics() { | ||
| return; | ||
|
|
||
| /* includes */ | ||
| include_once LANDINGPAGES_PATH . 'classes/class.statistics.php'; | ||
|
|
||
| $stats = Landing_Pages_Statistics::read_statistics( $this->lp_id ); | ||
|
|
||
| $this->assertEquals( count($stats) , 3 ); | ||
| $this->assertEquals( $stats['impressions'][0] , 0 ); | ||
| $this->assertEquals( $stats['conversions'][0] , 0 ); | ||
| $this->assertEquals( $stats['impressions'][1] , 0 ); | ||
| $this->assertEquals( $stats['conversions'][1] , 0 ); | ||
| } | ||
|
|
||
| /** | ||
| * launch a landing page | ||
| */ | ||
| function test_landing_page_read() { | ||
| return; | ||
|
|
||
| /* includes */ | ||
| include_once LANDINGPAGES_PATH . 'classes/class.statistics.php'; | ||
|
|
||
| $permalink = get_post_permalink( $this->lp_id , false ); | ||
| echo $permalink."\r\n"; | ||
| $permalink = 'http://local.wordpress.dev/go/ab-testing-landing-page-example-104/?lp-variation-id=1'; | ||
| $permalink = 'http://local.wordpress.dev/'; | ||
| print_r(inbound_remote_get( $permalink )); | ||
| /* | ||
| sleep(5); | ||
| $response = inbound_remote_get( $permalink ); | ||
| sleep(5); | ||
| $response = inbound_remote_get( $permalink ); | ||
| sleep(5); | ||
| $response = inbound_remote_get( $permalink ); | ||
| sleep(5); | ||
| $response = inbound_remote_get( add_query_arg( array('lp-variation-id'=> 0 ) , $permalink ) ); | ||
| sleep(5); | ||
| $response = inbound_remote_get( add_query_arg( array('lp-variation-id'=> 1 ) , $permalink ) ); | ||
| sleep(5); | ||
| */ | ||
| $stats = Landing_Pages_Statistics::read_statistics( $this->lp_id ); | ||
| print_r($stats); | ||
|
|
||
| $this->assertEquals( $stats['impressions'][0] , 3 ); | ||
| $this->assertEquals( $stats['conversions'][0] , 0 ); | ||
| $this->assertEquals( $stats['impressions'][1] , 3 ); | ||
| $this->assertEquals( $stats['conversions'][1] , 0 ); | ||
| } | ||
| } | ||
|
|
||
|
|