Skip to content
Snippets Groups Projects
Commit e8c6e567 authored by Erick Hitter's avatar Erick Hitter
Browse files

Begin tests

parent 8c55298d
No related branches found
No related tags found
1 merge request!3WIP: Add tests
Pipeline #1165 failed
This commit is part of merge request !3. Comments created here will be created in the context of that merge request.
...@@ -28,6 +28,7 @@ PHPunit:PHP5.3:MySQL: ...@@ -28,6 +28,7 @@ PHPunit:PHP5.3:MySQL:
image: containers.ethitter.com:443/docker/images/php:5.3 image: containers.ethitter.com:443/docker/images/php:5.3
services: services:
- mysql:5.6 - mysql:5.6
- redis:latest
script: script:
- find . -type "f" -iname "*.php" | xargs -L "1" php -l - find . -type "f" -iname "*.php" | xargs -L "1" php -l
- phpunit - phpunit
...@@ -37,6 +38,7 @@ PHPunit:PHP5.6:MySQL: ...@@ -37,6 +38,7 @@ PHPunit:PHP5.6:MySQL:
image: containers.ethitter.com:443/docker/images/php:5.6 image: containers.ethitter.com:443/docker/images/php:5.6
services: services:
- mysql:5.6 - mysql:5.6
- redis:latest
script: script:
- find . -type "f" -iname "*.php" | xargs -L "1" php -l - find . -type "f" -iname "*.php" | xargs -L "1" php -l
- phpunit - phpunit
...@@ -46,6 +48,7 @@ PHPunit:PHP7.0:MySQL: ...@@ -46,6 +48,7 @@ PHPunit:PHP7.0:MySQL:
image: containers.ethitter.com:443/docker/images/php:7.0 image: containers.ethitter.com:443/docker/images/php:7.0
services: services:
- mysql:5.6 - mysql:5.6
- redis:latest
script: script:
- find . -type "f" -iname "*.php" | xargs -L "1" php -l - find . -type "f" -iname "*.php" | xargs -L "1" php -l
- phpunit - phpunit
...@@ -55,6 +58,7 @@ PHPunit:PHP7.1:MySQL: ...@@ -55,6 +58,7 @@ PHPunit:PHP7.1:MySQL:
image: containers.ethitter.com:443/docker/images/php:7.1 image: containers.ethitter.com:443/docker/images/php:7.1
services: services:
- mysql:5.6 - mysql:5.6
- redis:latest
script: script:
- find . -type "f" -iname "*.php" | xargs -L "1" php -l - find . -type "f" -iname "*.php" | xargs -L "1" php -l
- phpunit - phpunit
...@@ -64,6 +68,7 @@ PHPunit:PHP7.2:MySQL: ...@@ -64,6 +68,7 @@ PHPunit:PHP7.2:MySQL:
image: containers.ethitter.com:443/docker/images/php:7.2 image: containers.ethitter.com:443/docker/images/php:7.2
services: services:
- mysql:5.6 - mysql:5.6
- redis:latest
script: script:
- find . -type "f" -iname "*.php" | xargs -L "1" php -l - find . -type "f" -iname "*.php" | xargs -L "1" php -l
- phpunit - phpunit
...@@ -73,6 +78,7 @@ PHPunit:PHP7.3:MySQL: ...@@ -73,6 +78,7 @@ PHPunit:PHP7.3:MySQL:
image: containers.ethitter.com:443/docker/images/php:7.3 image: containers.ethitter.com:443/docker/images/php:7.3
services: services:
- mysql:5.6 - mysql:5.6
- redis:latest
script: script:
- find . -type "f" -iname "*.php" | xargs -L "1" php -l - find . -type "f" -iname "*.php" | xargs -L "1" php -l
- phpunit - phpunit
......
...@@ -269,6 +269,15 @@ class WP_Redis_User_Session_Storage extends WP_Session_Tokens { ...@@ -269,6 +269,15 @@ class WP_Redis_User_Session_Storage extends WP_Session_Tokens {
protected function get_key() { protected function get_key() {
return $this->prefix . ':' . $this->user_id; return $this->prefix . ':' . $this->user_id;
} }
/**
* Is Redis connected?
*
* @return bool
*/
public function redis_connected() {
return $this->redis_connected;
}
} }
/** /**
......
<?php
/**
* Plugin tests
*
* @package WP_Redis_User_Session_Storage
*/
/**
* Class Test_Plugin.
*/
class Test_Plugin extends WP_UnitTestCase {
/**
* Check that Redis backend is available.
*/
public function test_connection() {
$this->assertTrue(
WP_Session_Tokens::get_instance( 0 )->redis_connected(),
'Failed to assert that Redis is available.'
);
}
}
<?php
/**
* Class SampleTest
*
* @package WP_Redis_User_Session_Storage
*/
/**
* Sample test case.
*/
class SampleTest extends WP_UnitTestCase {
/**
* A single example test.
*/
public function test_sample() {
// Replace this with some actual testing code.
$this->assertTrue( true );
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment