mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
ENH Use class name instead of self
This commit is contained in:
parent
a9f175bdd7
commit
161ed4a174
@ -326,7 +326,7 @@ class TestSessionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As with {@link self::start()}, if you want to extend the functionality of this, then look at
|
* As with {@link TestSessionController::start()}, if you want to extend the functionality of this, then look at
|
||||||
* {@link TestSessionEnvironent::endTestSession()} as the extension points have moved to there now that the logic
|
* {@link TestSessionEnvironent::endTestSession()} as the extension points have moved to there now that the logic
|
||||||
* is there.
|
* is there.
|
||||||
*/
|
*/
|
||||||
|
@ -62,7 +62,7 @@ class TestSessionEnvironment
|
|||||||
/**
|
/**
|
||||||
* @var string The original database name, before we overrode it with our tmpdb.
|
* @var string The original database name, before we overrode it with our tmpdb.
|
||||||
*
|
*
|
||||||
* Used in {@link self::resetDatabaseName()} when we want to restore the normal DB connection.
|
* Used in {@link TestSessionEnvironment::resetDatabaseName()} when we want to restore the normal DB connection.
|
||||||
*/
|
*/
|
||||||
private $oldDatabaseName;
|
private $oldDatabaseName;
|
||||||
|
|
||||||
@ -136,14 +136,16 @@ class TestSessionEnvironment
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a temp database, sets up any extra requirements, and writes the state file. The database will be
|
* Creates a temp database, sets up any extra requirements, and writes the state file. The database will be
|
||||||
* connected to as part of {@link self::applyState()}, so if you're continuing script execution after calling this
|
* connected to as part of {@link TestSessionEnvironment::applyState()}, so if you're continuing script
|
||||||
|
* execution after calling this
|
||||||
* method, be aware that the database will be different - so various things may break (e.g. administrator logins
|
* method, be aware that the database will be different - so various things may break (e.g. administrator logins
|
||||||
* using the SS_DEFAULT_USERNAME / SS_DEFAULT_PASSWORD constants).
|
* using the SS_DEFAULT_USERNAME / SS_DEFAULT_PASSWORD constants).
|
||||||
*
|
*
|
||||||
* If something isn't explicitly handled here, and needs special handling, then it should be taken care of by an
|
* If something isn't explicitly handled here, and needs special handling, then it should be taken care of by an
|
||||||
* extension to TestSessionEnvironment. You can either extend onBeforeStartTestSession() or
|
* extension to TestSessionEnvironment. You can either extend onBeforeStartTestSession() or
|
||||||
* onAfterStartTestSession(). Alternatively, for more fine-grained control, you can also extend
|
* onAfterStartTestSession(). Alternatively, for more fine-grained control, you can also extend
|
||||||
* onBeforeApplyState() and onAfterApplyState(). See the {@link self::applyState()} method for more.
|
* onBeforeApplyState() and onAfterApplyState(). See the {@link TestSessionEnvironment::applyState()}
|
||||||
|
* method for more.
|
||||||
*
|
*
|
||||||
* @param array $state An array of test state options to write.
|
* @param array $state An array of test state options to write.
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
@ -436,7 +438,8 @@ class TestSessionEnvironment
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up the test session state by restoring the normal database connect (for the rest of this request, if any)
|
* Cleans up the test session state by restoring the normal database connect (for the rest of this request, if any)
|
||||||
* and removes the {@link self::$test_state_file} so that future requests don't use this test state.
|
* and removes the {@link TestSessionEnvironment::$test_state_file} so that future requests don't use this
|
||||||
|
* test state.
|
||||||
*
|
*
|
||||||
* Can be extended by implementing either onBeforeEndTestSession() or onAfterEndTestSession().
|
* Can be extended by implementing either onBeforeEndTestSession() or onAfterEndTestSession().
|
||||||
*
|
*
|
||||||
@ -505,7 +508,8 @@ class TestSessionEnvironment
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the database connection to use the original database. Called by {@link self::endTestSession()}.
|
* Reset the database connection to use the original database.
|
||||||
|
* Called by {@link TestSessionEnvironment::endTestSession()}.
|
||||||
*/
|
*/
|
||||||
public function resetDatabaseName()
|
public function resetDatabaseName()
|
||||||
{
|
{
|
||||||
@ -523,7 +527,7 @@ class TestSessionEnvironment
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return stdClass Data as taken from the JSON object in {@link self::loadFromFile()}
|
* @return stdClass Data as taken from the JSON object in {@link TestSessionEnvironment::loadFromFile()}
|
||||||
*/
|
*/
|
||||||
public function getState()
|
public function getState()
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ class TestSessionState extends DataObject
|
|||||||
{
|
{
|
||||||
$schema = DataObject::getSchema();
|
$schema = DataObject::getSchema();
|
||||||
|
|
||||||
$update = SQLUpdate::create(sprintf('"%s"', $schema->tableName(self::class)))
|
$update = SQLUpdate::create(sprintf('"%s"', $schema->tableName(TestSessionState::class)))
|
||||||
->addWhere(['ID' => 1])
|
->addWhere(['ID' => 1])
|
||||||
->assignSQL('"PendingRequests"', '"PendingRequests" + 1');
|
->assignSQL('"PendingRequests"', '"PendingRequests" + 1');
|
||||||
|
|
||||||
@ -50,10 +50,10 @@ class TestSessionState extends DataObject
|
|||||||
{
|
{
|
||||||
$schema = DataObject::getSchema();
|
$schema = DataObject::getSchema();
|
||||||
|
|
||||||
$update = SQLUpdate::create(sprintf('"%s"', $schema->tableName(self::class)))
|
$update = SQLUpdate::create(sprintf('"%s"', $schema->tableName(TestSessionState::class)))
|
||||||
->addWhere(['ID' => 1])
|
->addWhere(['ID' => 1])
|
||||||
->assignSQL('"PendingRequests"', '"PendingRequests" - 1')
|
->assignSQL('"PendingRequests"', '"PendingRequests" - 1')
|
||||||
->assign('"LastResponseTimestamp"', self::millitime());
|
->assign('"LastResponseTimestamp"', TestSessionState::millitime());
|
||||||
|
|
||||||
$update->execute();
|
$update->execute();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user