mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
Upgrade to L5 + huge refactor + more. closes #2
New stuff: - Signup + email confirmation. - Updated authentication strategy with remember cookies. closes #5 - New search system with some example gambits! This is cool - check out the source. Fulltext drivers will be implemented as decorators overriding the EloquentPostRepository’s findByContent method. - Lay down the foundation for bootstrapping the Ember app. - Update Web layer’s asset manager to properly publish CSS/JS files. - Console commands to run installation migrations and seeds. Refactoring: - New structure: move models, repositories, commands, and events into their own namespaces, rather than grouping by entity. - All events are classes. - Use L5 middleware and command bus implementations. - Clearer use of repositories and the Active Record pattern. Repositories are used only for retrieval of ActiveRecord objects, and then save/delete operations are called directly on those ActiveRecords. This way, we don’t over-abstract at the cost of Eloquent magic, but testing is still easy. - Refactor of Web layer so that it uses the Actions routing architecture. - “Actor” concept instead of depending on Laravel’s Auth. - General cleanup!
This commit is contained in:
@@ -2,19 +2,23 @@
|
||||
namespace Codeception\Module;
|
||||
|
||||
use Laracasts\TestDummy\Factory;
|
||||
use Auth;
|
||||
use DB;
|
||||
|
||||
class ApiHelper extends \Codeception\Module
|
||||
{
|
||||
public function haveAnAccount($data = [])
|
||||
{
|
||||
return Factory::create('Flarum\Core\Users\User', $data);
|
||||
$user = Factory::create('Flarum\Core\Models\User', $data);
|
||||
$user->activate();
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function login($identification, $password)
|
||||
{
|
||||
$this->getModule('REST')->sendPOST('/api/auth/login', ['identification' => $identification, 'password' => $password]);
|
||||
$this->getModule('REST')->sendPOST('/api/token', [
|
||||
'identification' => $identification,
|
||||
'password' => $password
|
||||
]);
|
||||
|
||||
$response = json_decode($this->getModule('REST')->grabResponse(), true);
|
||||
if ($response && is_array($response) && isset($response['token'])) {
|
||||
@@ -27,8 +31,8 @@ class ApiHelper extends \Codeception\Module
|
||||
public function amAuthenticated()
|
||||
{
|
||||
$user = $this->haveAnAccount();
|
||||
$user->groups()->attach(3); // Add member group
|
||||
Auth::onceUsingId($user->id);
|
||||
$token = $this->login($user->email, 'password');
|
||||
$this->getModule('REST')->haveHttpHeader('Authorization', 'Token '.$token);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php //[STAMP] 62377ab49c890e65388dcf2e4aedfd9c
|
||||
<?php //[STAMP] c39b1e7ca7bb0234c110424ed8081d25
|
||||
|
||||
// This class was automatically generated by build task
|
||||
// You should not change it manually as it will be overwritten on next build
|
||||
@@ -1117,6 +1117,7 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Sets a cookie with the given name and value.
|
||||
* You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1124,13 +1125,16 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
* @param $value
|
||||
* @param $name
|
||||
* @param $val
|
||||
* @param array $params
|
||||
* @internal param $cookie
|
||||
* @internal param $value
|
||||
*
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::setCookie()
|
||||
*/
|
||||
public function setCookie($name, $val) {
|
||||
public function setCookie($name, $val, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1139,13 +1143,15 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Grabs a cookie value.
|
||||
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::grabCookie()
|
||||
*/
|
||||
public function grabCookie($name) {
|
||||
public function grabCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1154,6 +1160,7 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that a cookie with the given name is set.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1162,18 +1169,19 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
||||
*/
|
||||
public function canSeeCookie($name) {
|
||||
public function canSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that a cookie with the given name is set.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1182,11 +1190,11 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
||||
*/
|
||||
public function seeCookie($name) {
|
||||
public function seeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1195,27 +1203,31 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that there isn't a cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
||||
*/
|
||||
public function cantSeeCookie($name) {
|
||||
public function cantSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that there isn't a cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
||||
*/
|
||||
public function dontSeeCookie($name) {
|
||||
public function dontSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1224,13 +1236,15 @@ class AcceptanceTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Unsets cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::resetCookie()
|
||||
*/
|
||||
public function resetCookie($name) {
|
||||
public function resetCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
|
||||
}
|
||||
|
||||
|
@@ -1,3 +1,7 @@
|
||||
class_name: ApiTester
|
||||
modules:
|
||||
enabled: [Laravel4, REST, Asserts, ApiHelper]
|
||||
enabled: [Laravel5, REST, Asserts, ApiHelper]
|
||||
config:
|
||||
Laravel5:
|
||||
root: ../../
|
||||
environment_file: .env.testing
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php //[STAMP] 93c972ae47d60c70b9045d971476f0bc
|
||||
<?php //[STAMP] 0c4e854121e386cfc0ad09b1634fc196
|
||||
|
||||
// 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\Laravel4;
|
||||
use Codeception\Module\Laravel5;
|
||||
use Codeception\Module\REST;
|
||||
use Codeception\Module\Asserts;
|
||||
use Codeception\Module\ApiHelper;
|
||||
@@ -31,22 +31,13 @@ class ApiTester extends \Codeception\Actor
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Enable Laravel filters for next requests.
|
||||
* @see \Codeception\Module\Laravel4::haveEnabledFilters()
|
||||
*/
|
||||
public function haveEnabledFilters() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('haveEnabledFilters', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
* Provides access the Laravel application object.
|
||||
*
|
||||
* Disable Laravel filters for next requests.
|
||||
* @see \Codeception\Module\Laravel4::haveDisabledFilters()
|
||||
* @return \Illuminate\Foundation\Application
|
||||
* @see \Codeception\Module\Laravel5::getApplication()
|
||||
*/
|
||||
public function haveDisabledFilters() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('haveDisabledFilters', func_get_args()));
|
||||
public function getApplication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('getApplication', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +54,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::amOnRoute()
|
||||
* @see \Codeception\Module\Laravel5::amOnRoute()
|
||||
*/
|
||||
public function amOnRoute($route, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Condition('amOnRoute', func_get_args()));
|
||||
@@ -83,7 +74,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::amOnAction()
|
||||
* @see \Codeception\Module\Laravel5::amOnAction()
|
||||
*/
|
||||
public function amOnAction($action, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Condition('amOnAction', func_get_args()));
|
||||
@@ -103,7 +94,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentRouteIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function canSeeCurrentRouteIs($route, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentRouteIs', func_get_args()));
|
||||
@@ -120,7 +111,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* ```
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentRouteIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function seeCurrentRouteIs($route, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentRouteIs', func_get_args()));
|
||||
@@ -141,7 +132,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentActionIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentActionIs()
|
||||
*/
|
||||
public function canSeeCurrentActionIs($action, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentActionIs', func_get_args()));
|
||||
@@ -159,7 +150,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentActionIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentActionIs()
|
||||
*/
|
||||
public function seeCurrentActionIs($action, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentActionIs', func_get_args()));
|
||||
@@ -175,7 +166,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeInSession()
|
||||
* @see \Codeception\Module\Laravel5::seeInSession()
|
||||
*/
|
||||
public function canSeeInSession($key, $value = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInSession', func_get_args()));
|
||||
@@ -188,7 +179,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel4::seeInSession()
|
||||
* @see \Codeception\Module\Laravel5::seeInSession()
|
||||
*/
|
||||
public function seeInSession($key, $value = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInSession', func_get_args()));
|
||||
@@ -203,7 +194,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param array $bindings
|
||||
* @return void
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasValues()
|
||||
* @see \Codeception\Module\Laravel5::seeSessionHasValues()
|
||||
*/
|
||||
public function canSeeSessionHasValues($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeSessionHasValues', func_get_args()));
|
||||
@@ -215,7 +206,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @param array $bindings
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasValues()
|
||||
* @see \Codeception\Module\Laravel5::seeSessionHasValues()
|
||||
*/
|
||||
public function seeSessionHasValues($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeSessionHasValues', func_get_args()));
|
||||
@@ -225,74 +216,121 @@ class ApiTester extends \Codeception\Actor
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that Session has error messages
|
||||
* The seeSessionHasValues cannot be used, as Message bag Object is returned by Laravel4
|
||||
* Assert that the form errors are bound to the View.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeSessionErrorMessage(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* @return bool
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeSessionErrorMessage()
|
||||
* @see \Codeception\Module\Laravel5::seeFormHasErrors()
|
||||
*/
|
||||
public function canSeeSessionErrorMessage($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeSessionErrorMessage', func_get_args()));
|
||||
public function canSeeFormHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFormHasErrors', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that Session has error messages
|
||||
* The seeSessionHasValues cannot be used, as Message bag Object is returned by Laravel4
|
||||
* Assert that the form errors are bound to the View.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeSessionErrorMessage(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* @see \Codeception\Module\Laravel4::seeSessionErrorMessage()
|
||||
* @return bool
|
||||
* @see \Codeception\Module\Laravel5::seeFormHasErrors()
|
||||
*/
|
||||
public function seeSessionErrorMessage($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeSessionErrorMessage', func_get_args()));
|
||||
public function seeFormHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFormHasErrors', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that the session has errors bound.
|
||||
* Assert that specific form error messages are set in the view.
|
||||
*
|
||||
* @return bool
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessages(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasErrors()
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessages()
|
||||
*/
|
||||
public function canSeeSessionHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeSessionHasErrors', func_get_args()));
|
||||
public function canSeeFormErrorMessages($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFormErrorMessages', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that the session has errors bound.
|
||||
* Assert that specific form error messages are set in the view.
|
||||
*
|
||||
* @return bool
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasErrors()
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessages(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessages()
|
||||
*/
|
||||
public function seeSessionHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeSessionHasErrors', func_get_args()));
|
||||
public function seeFormErrorMessages($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFormErrorMessages', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error message is set in the view.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessage('username', 'Invalid Username');
|
||||
* ?>
|
||||
* ```
|
||||
* @param string $key
|
||||
* @param string $errorMessage
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessage()
|
||||
*/
|
||||
public function canSeeFormErrorMessage($key, $errorMessage) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFormErrorMessage', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error message is set in the view.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessage('username', 'Invalid Username');
|
||||
* ?>
|
||||
* ```
|
||||
* @param string $key
|
||||
* @param string $errorMessage
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessage()
|
||||
*/
|
||||
public function seeFormErrorMessage($key, $errorMessage) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFormErrorMessage', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
@@ -300,12 +338,13 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Set the currently logged in user for the application.
|
||||
* Takes either `UserInterface` instance or array of credentials.
|
||||
* Takes either an object that implements the User interface or
|
||||
* an array of credentials.
|
||||
*
|
||||
* @param \Illuminate\Auth\UserInterface|array $user
|
||||
* @param \Illuminate\Contracts\Auth\User|array $user
|
||||
* @param string $driver
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel4::amLoggedAs()
|
||||
* @see \Codeception\Module\Laravel5::amLoggedAs()
|
||||
*/
|
||||
public function amLoggedAs($user, $driver = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Condition('amLoggedAs', func_get_args()));
|
||||
@@ -316,7 +355,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Logs user out
|
||||
* @see \Codeception\Module\Laravel4::logout()
|
||||
* @see \Codeception\Module\Laravel5::logout()
|
||||
*/
|
||||
public function logout() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('logout', func_get_args()));
|
||||
@@ -328,7 +367,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* Checks that user is authenticated
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::seeAuthentication()
|
||||
*/
|
||||
public function canSeeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeAuthentication', func_get_args()));
|
||||
@@ -337,7 +376,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that user is authenticated
|
||||
* @see \Codeception\Module\Laravel4::seeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::seeAuthentication()
|
||||
*/
|
||||
public function seeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeAuthentication', func_get_args()));
|
||||
@@ -349,7 +388,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* Check that user is not authenticated
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::dontSeeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeAuthentication()
|
||||
*/
|
||||
public function cantSeeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeAuthentication', func_get_args()));
|
||||
@@ -358,7 +397,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Check that user is not authenticated
|
||||
* @see \Codeception\Module\Laravel4::dontSeeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeAuthentication()
|
||||
*/
|
||||
public function dontSeeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeAuthentication', func_get_args()));
|
||||
@@ -389,7 +428,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @param string $class
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel4::grabService()
|
||||
* @see \Codeception\Module\Laravel5::grabService()
|
||||
*/
|
||||
public function grabService($class) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('grabService', func_get_args()));
|
||||
@@ -410,7 +449,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel4::haveRecord()
|
||||
* @see \Codeception\Module\Laravel5::haveRecord()
|
||||
*/
|
||||
public function haveRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('haveRecord', func_get_args()));
|
||||
@@ -429,7 +468,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeRecord()
|
||||
* @see \Codeception\Module\Laravel5::seeRecord()
|
||||
*/
|
||||
public function canSeeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeRecord', func_get_args()));
|
||||
@@ -445,7 +484,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @see \Codeception\Module\Laravel4::seeRecord()
|
||||
* @see \Codeception\Module\Laravel5::seeRecord()
|
||||
*/
|
||||
public function seeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeRecord', func_get_args()));
|
||||
@@ -466,7 +505,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::dontSeeRecord()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeRecord()
|
||||
*/
|
||||
public function cantSeeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeRecord', func_get_args()));
|
||||
@@ -484,7 +523,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @see \Codeception\Module\Laravel4::dontSeeRecord()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeRecord()
|
||||
*/
|
||||
public function dontSeeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeRecord', func_get_args()));
|
||||
@@ -505,7 +544,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel4::grabRecord()
|
||||
* @see \Codeception\Module\Laravel5::grabRecord()
|
||||
*/
|
||||
public function grabRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('grabRecord', func_get_args()));
|
||||
@@ -1519,6 +1558,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Sets a cookie with the given name and value.
|
||||
* You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1526,13 +1566,16 @@ class ApiTester extends \Codeception\Actor
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
* @param $value
|
||||
* @param $name
|
||||
* @param $val
|
||||
* @param array $params
|
||||
* @internal param $cookie
|
||||
* @internal param $value
|
||||
*
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::setCookie()
|
||||
*/
|
||||
public function setCookie($name, $val) {
|
||||
public function setCookie($name, $val, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1541,13 +1584,15 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Grabs a cookie value.
|
||||
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::grabCookie()
|
||||
*/
|
||||
public function grabCookie($name) {
|
||||
public function grabCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1556,6 +1601,7 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that a cookie with the given name is set.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1564,18 +1610,19 @@ class ApiTester extends \Codeception\Actor
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
||||
*/
|
||||
public function canSeeCookie($name) {
|
||||
public function canSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that a cookie with the given name is set.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1584,11 +1631,11 @@ class ApiTester extends \Codeception\Actor
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
||||
*/
|
||||
public function seeCookie($name) {
|
||||
public function seeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1597,27 +1644,31 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that there isn't a cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
||||
*/
|
||||
public function cantSeeCookie($name) {
|
||||
public function cantSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that there isn't a cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
||||
*/
|
||||
public function dontSeeCookie($name) {
|
||||
public function dontSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1626,13 +1677,15 @@ class ApiTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Unsets cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::resetCookie()
|
||||
*/
|
||||
public function resetCookie($name) {
|
||||
public function resetCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -2527,7 +2580,6 @@ class ApiTester extends \Codeception\Actor
|
||||
* This assertion allows you to check the structure of response json.
|
||||
* *
|
||||
* ```json
|
||||
* ```json
|
||||
* { "store": {
|
||||
* "book": [
|
||||
* { "category": "reference",
|
||||
@@ -2575,7 +2627,6 @@ class ApiTester extends \Codeception\Actor
|
||||
* This assertion allows you to check the structure of response json.
|
||||
* *
|
||||
* ```json
|
||||
* ```json
|
||||
* { "store": {
|
||||
* "book": [
|
||||
* { "category": "reference",
|
||||
@@ -2715,6 +2766,31 @@ class ApiTester extends \Codeception\Actor
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Opposite to seeResponseJsonMatchesJsonPath
|
||||
*
|
||||
* @param array $jsonPath
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath()
|
||||
*/
|
||||
public function cantSeeResponseJsonMatchesJsonPath($jsonPath) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseJsonMatchesJsonPath', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Opposite to seeResponseJsonMatchesJsonPath
|
||||
*
|
||||
* @param array $jsonPath
|
||||
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath()
|
||||
*/
|
||||
public function dontSeeResponseJsonMatchesJsonPath($jsonPath) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseJsonMatchesJsonPath', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
@@ -3048,7 +3124,7 @@ class ApiTester extends \Codeception\Actor
|
||||
*
|
||||
* @see \Codeception\Module\ApiHelper::login()
|
||||
*/
|
||||
public function login($identifier, $password) {
|
||||
public function login($identification, $password) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('login', func_get_args()));
|
||||
}
|
||||
|
||||
|
@@ -19,11 +19,11 @@ class AuthCest
|
||||
$I->login('foo@bar.com', 'pass7word');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
|
||||
|
||||
$token = $I->grabDataFromJsonResponse('token');
|
||||
$userId = $I->grabDataFromJsonResponse('userId');
|
||||
$I->assertNotEmpty($token);
|
||||
|
||||
|
||||
$loggedIn = User::where('token', $token)->where('id', $userId)->first();
|
||||
$I->assertEquals($user->id, $loggedIn->id);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class AuthCest
|
||||
$I->login('tobscure', 'pass7word');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
|
||||
|
||||
$token = $I->grabDataFromJsonResponse('token');
|
||||
$userId = $I->grabDataFromJsonResponse('userId');
|
||||
$I->assertNotEmpty($token);
|
||||
@@ -60,4 +60,4 @@ class AuthCest
|
||||
$I->seeResponseCodeIs(401);
|
||||
$I->seeResponseIsJson();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,16 @@
|
||||
<?php
|
||||
use \ApiTester;
|
||||
|
||||
use Laracasts\TestDummy\Factory;
|
||||
|
||||
class DiscussionsResourceCest {
|
||||
|
||||
class DiscussionsResourceCest
|
||||
{
|
||||
protected $endpoint = '/api/discussions';
|
||||
|
||||
public function getDiscussions(ApiTester $I)
|
||||
{
|
||||
$I->wantTo('get discussions via API');
|
||||
|
||||
$discussions = Factory::times(2)->create('Flarum\Core\Discussions\Discussion');
|
||||
$discussions = Factory::times(2)->create('Flarum\Core\Models\Discussion');
|
||||
|
||||
$I->sendGET($this->endpoint);
|
||||
$I->seeResponseCodeIs(200);
|
||||
@@ -20,7 +19,7 @@ class DiscussionsResourceCest {
|
||||
$I->expect('there are two discussions in the response');
|
||||
$I->assertEquals(2, count($I->grabDataFromJsonResponse('discussions')));
|
||||
|
||||
$I->expect('they are the discussions we created');
|
||||
$I->expect('the discussions exist');
|
||||
$I->seeResponseContainsJson(['id' => (string) $discussions[0]->id, 'title' => $discussions[0]->title]);
|
||||
$I->seeResponseContainsJson(['id' => (string) $discussions[1]->id, 'title' => $discussions[1]->title]);
|
||||
}
|
||||
@@ -29,12 +28,13 @@ class DiscussionsResourceCest {
|
||||
{
|
||||
$I->wantTo('show a single discussion via API');
|
||||
|
||||
$discussion = Factory::create('Flarum\Core\Discussions\Discussion');
|
||||
$discussion = Factory::create('Flarum\Core\Models\Discussion');
|
||||
|
||||
$I->sendGET($this->endpoint.'/'.$discussion->id);
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
|
||||
$I->expect('the discussion in the response exists');
|
||||
$I->seeResponseContainsJson(['discussions' => ['id' => (string) $discussion->id, 'title' => $discussion->title]]);
|
||||
}
|
||||
|
||||
@@ -47,11 +47,14 @@ class DiscussionsResourceCest {
|
||||
$I->sendPOST($this->endpoint, ['discussions' => ['title' => 'foo', 'content' => 'bar']]);
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
|
||||
$I->expect('the discussion is included in the response');
|
||||
$I->seeResponseContainsJson(['title' => 'foo']);
|
||||
|
||||
$I->expect('posts are included in the response');
|
||||
$I->seeResponseContainsJson(['type' => 'comment', 'contentHtml' => '<p>bar</p>']);
|
||||
|
||||
// @todo check for post in response
|
||||
|
||||
$I->expect('the discussion was created in the database');
|
||||
$id = $I->grabDataFromJsonResponse('discussions.id');
|
||||
$I->seeRecord('discussions', ['id' => $id, 'title' => 'foo']);
|
||||
}
|
||||
@@ -62,13 +65,16 @@ class DiscussionsResourceCest {
|
||||
|
||||
$user = $I->amAuthenticated();
|
||||
|
||||
$discussion = Factory::create('Flarum\Core\Discussions\Discussion', ['start_user_id' => $user->id]);
|
||||
$discussion = Factory::create('Flarum\Core\Models\Discussion', ['start_user_id' => $user->id]);
|
||||
|
||||
$I->sendPUT($this->endpoint.'/'.$discussion->id, ['discussions' => ['title' => 'foo']]);
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
|
||||
$I->expect('the discussion title was updated');
|
||||
$I->seeResponseContainsJson(['title' => 'foo']);
|
||||
|
||||
$I->expect('the discussion was updated in the database');
|
||||
$id = $I->grabDataFromJsonResponse('discussions.id');
|
||||
$I->seeRecord('discussions', ['id' => $id, 'title' => 'foo']);
|
||||
}
|
||||
@@ -78,14 +84,15 @@ class DiscussionsResourceCest {
|
||||
$I->wantTo('delete a discussion via API');
|
||||
|
||||
$user = $I->amAuthenticated();
|
||||
$user->groups()->attach(4);
|
||||
$user->groups()->attach(4); // Make the user a moderator
|
||||
|
||||
$discussion = Factory::create('Flarum\Core\Discussions\Discussion', ['start_user_id' => $user->id]);
|
||||
$discussion = Factory::create('Flarum\Core\Models\Discussion', ['start_user_id' => $user->id]);
|
||||
|
||||
$I->sendDELETE($this->endpoint.'/'.$discussion->id);
|
||||
$I->seeResponseCodeIs(204);
|
||||
$I->seeResponseEquals('');
|
||||
|
||||
$I->expect('the discussion was deleted in the database');
|
||||
$I->dontSeeRecord('discussions', ['id' => $discussion->id]);
|
||||
}
|
||||
}
|
||||
|
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
|
||||
$factory('Flarum\Core\Discussions\Discussion', [
|
||||
$factory('Flarum\Core\Models\Discussion', [
|
||||
'title' => $faker->sentence,
|
||||
'start_time' => $faker->dateTimeThisYear,
|
||||
'start_user_id' => 'factory:Flarum\Core\Users\User'
|
||||
'start_user_id' => 'factory:Flarum\Core\Models\User'
|
||||
]);
|
||||
|
||||
$factory('Flarum\Core\Users\User', [
|
||||
$factory('Flarum\Core\Models\User', [
|
||||
'username' => $faker->userName,
|
||||
'email' => $faker->safeEmail,
|
||||
'password' => 'password',
|
||||
'join_time' => $faker->dateTimeThisYear,
|
||||
'time_zone' => $faker->timezone
|
||||
]);
|
||||
'join_time' => $faker->dateTimeThisYear
|
||||
]);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php //[STAMP] 92e3a5639db903a93dbc0ada7934f9ca
|
||||
<?php //[STAMP] 40f12b65758ce0396ebc7f7f0af11f8c
|
||||
|
||||
// This class was automatically generated by build task
|
||||
// You should not change it manually as it will be overwritten on next build
|
||||
|
@@ -1,3 +1,7 @@
|
||||
class_name: IntegrationTester
|
||||
modules:
|
||||
enabled: [IntegrationHelper, Laravel4, Mockery]
|
||||
enabled: [IntegrationHelper, Laravel5, Mockery]
|
||||
config:
|
||||
Laravel5:
|
||||
root: ../../
|
||||
environment_file: .env.testing
|
||||
|
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Laracasts\TestDummy\Factory;
|
||||
use \Mockery as m;
|
||||
use Flarum\Core\Users\User;
|
||||
use Flarum\Core\Discussions\Discussion;
|
||||
use Flarum\Core\Discussions\DiscussionRepository;
|
||||
use Codeception\Util\Stub;
|
||||
|
||||
class DiscussionRepositoryTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
* @var \IntegrationTester
|
||||
*/
|
||||
protected $tester;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->repo = new DiscussionRepository;
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function testGetDiscussionByID()
|
||||
{
|
||||
// Given I have a discussion
|
||||
$discussion = Factory::create('Flarum\Core\Discussions\Discussion');
|
||||
|
||||
// When I fetch the discussion by its ID
|
||||
$result = $this->repo->find($discussion->id);
|
||||
|
||||
// Then I should receive it
|
||||
$this->assertEquals($discussion->id, $result->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException Illuminate\Database\Eloquent\ModelNotFoundException
|
||||
*/
|
||||
public function testDiscussionCannotBeViewed()
|
||||
{
|
||||
// Given I have a discussion
|
||||
$discussion = Factory::create('Flarum\Core\Discussions\Discussion');
|
||||
|
||||
// And forum permissions do not allow guests to view the forum
|
||||
$manager = m::mock('Flarum\Core\Permissions\Manager');
|
||||
$manager->shouldReceive('granted')->andReturn(false);
|
||||
app()->instance('flarum.permissions', $manager);
|
||||
|
||||
// When I fetch the discussion by its ID, I expect an exception to be thrown
|
||||
$this->repo->findOrFail($discussion->id, new Flarum\Core\Users\Guest);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function testSaveDiscussion()
|
||||
{
|
||||
// Given I have a new discussion
|
||||
$user = Factory::create('Flarum\Core\Users\User');
|
||||
$discussion = Discussion::start('foo', $user);
|
||||
|
||||
// When I save it
|
||||
$discussion = $this->repo->save($discussion);
|
||||
|
||||
// Then it should be in the database
|
||||
$this->tester->seeRecord('discussions', ['title' => 'foo']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException Flarum\Core\Support\Exceptions\ValidationFailureException
|
||||
*/
|
||||
public function testSaveInvalidDiscussion()
|
||||
{
|
||||
// Given I have a new discussion containing no information
|
||||
$discussion = new Discussion;
|
||||
|
||||
// When I save it, I expect an exception to be thrown
|
||||
$this->repo->save($discussion);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function testDeleteDiscussion()
|
||||
{
|
||||
// Given I have a discussion
|
||||
$discussion = Factory::create('Flarum\Core\Discussions\Discussion');
|
||||
|
||||
// When I delete it
|
||||
$this->repo->delete($discussion);
|
||||
|
||||
// Then it should no longer be in the database
|
||||
$this->tester->dontSeeRecord('discussions', ['id' => $discussion->id]);
|
||||
}
|
||||
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
<?php //[STAMP] 879ecac65759e12fe5ae69eb3feba6b8
|
||||
<?php //[STAMP] 6f66848bf7db9fd98f774b8bf10f73a2
|
||||
|
||||
// This class was automatically generated by build task
|
||||
// You should not change it manually as it will be overwritten on next build
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
use Codeception\Module\IntegrationHelper;
|
||||
use Codeception\Module\Laravel4;
|
||||
use Codeception\Module\Laravel5;
|
||||
use Codeception\Module\Mockery;
|
||||
|
||||
/**
|
||||
@@ -30,22 +30,13 @@ class IntegrationTester extends \Codeception\Actor
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Enable Laravel filters for next requests.
|
||||
* @see \Codeception\Module\Laravel4::haveEnabledFilters()
|
||||
*/
|
||||
public function haveEnabledFilters() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('haveEnabledFilters', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
* Provides access the Laravel application object.
|
||||
*
|
||||
* Disable Laravel filters for next requests.
|
||||
* @see \Codeception\Module\Laravel4::haveDisabledFilters()
|
||||
* @return \Illuminate\Foundation\Application
|
||||
* @see \Codeception\Module\Laravel5::getApplication()
|
||||
*/
|
||||
public function haveDisabledFilters() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('haveDisabledFilters', func_get_args()));
|
||||
public function getApplication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('getApplication', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +53,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::amOnRoute()
|
||||
* @see \Codeception\Module\Laravel5::amOnRoute()
|
||||
*/
|
||||
public function amOnRoute($route, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Condition('amOnRoute', func_get_args()));
|
||||
@@ -82,7 +73,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::amOnAction()
|
||||
* @see \Codeception\Module\Laravel5::amOnAction()
|
||||
*/
|
||||
public function amOnAction($action, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Condition('amOnAction', func_get_args()));
|
||||
@@ -102,7 +93,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentRouteIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function canSeeCurrentRouteIs($route, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentRouteIs', func_get_args()));
|
||||
@@ -119,7 +110,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* ```
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentRouteIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function seeCurrentRouteIs($route, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentRouteIs', func_get_args()));
|
||||
@@ -140,7 +131,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentActionIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentActionIs()
|
||||
*/
|
||||
public function canSeeCurrentActionIs($action, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentActionIs', func_get_args()));
|
||||
@@ -158,7 +149,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel4::seeCurrentActionIs()
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentActionIs()
|
||||
*/
|
||||
public function seeCurrentActionIs($action, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentActionIs', func_get_args()));
|
||||
@@ -174,7 +165,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeInSession()
|
||||
* @see \Codeception\Module\Laravel5::seeInSession()
|
||||
*/
|
||||
public function canSeeInSession($key, $value = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInSession', func_get_args()));
|
||||
@@ -187,7 +178,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel4::seeInSession()
|
||||
* @see \Codeception\Module\Laravel5::seeInSession()
|
||||
*/
|
||||
public function seeInSession($key, $value = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInSession', func_get_args()));
|
||||
@@ -202,7 +193,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param array $bindings
|
||||
* @return void
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasValues()
|
||||
* @see \Codeception\Module\Laravel5::seeSessionHasValues()
|
||||
*/
|
||||
public function canSeeSessionHasValues($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeSessionHasValues', func_get_args()));
|
||||
@@ -214,7 +205,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* @param array $bindings
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasValues()
|
||||
* @see \Codeception\Module\Laravel5::seeSessionHasValues()
|
||||
*/
|
||||
public function seeSessionHasValues($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeSessionHasValues', func_get_args()));
|
||||
@@ -224,74 +215,121 @@ class IntegrationTester extends \Codeception\Actor
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that Session has error messages
|
||||
* The seeSessionHasValues cannot be used, as Message bag Object is returned by Laravel4
|
||||
* Assert that the form errors are bound to the View.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeSessionErrorMessage(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* @return bool
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeSessionErrorMessage()
|
||||
* @see \Codeception\Module\Laravel5::seeFormHasErrors()
|
||||
*/
|
||||
public function canSeeSessionErrorMessage($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeSessionErrorMessage', func_get_args()));
|
||||
public function canSeeFormHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFormHasErrors', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that Session has error messages
|
||||
* The seeSessionHasValues cannot be used, as Message bag Object is returned by Laravel4
|
||||
* Assert that the form errors are bound to the View.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeSessionErrorMessage(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* @see \Codeception\Module\Laravel4::seeSessionErrorMessage()
|
||||
* @return bool
|
||||
* @see \Codeception\Module\Laravel5::seeFormHasErrors()
|
||||
*/
|
||||
public function seeSessionErrorMessage($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeSessionErrorMessage', func_get_args()));
|
||||
public function seeFormHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFormHasErrors', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that the session has errors bound.
|
||||
* Assert that specific form error messages are set in the view.
|
||||
*
|
||||
* @return bool
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessages(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasErrors()
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessages()
|
||||
*/
|
||||
public function canSeeSessionHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeSessionHasErrors', func_get_args()));
|
||||
public function canSeeFormErrorMessages($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFormErrorMessages', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that the session has errors bound.
|
||||
* Assert that specific form error messages are set in the view.
|
||||
*
|
||||
* @return bool
|
||||
* @see \Codeception\Module\Laravel4::seeSessionHasErrors()
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessages(array('username'=>'Invalid Username'));
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessages()
|
||||
*/
|
||||
public function seeSessionHasErrors() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeSessionHasErrors', func_get_args()));
|
||||
public function seeFormErrorMessages($bindings) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFormErrorMessages', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error message is set in the view.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessage('username', 'Invalid Username');
|
||||
* ?>
|
||||
* ```
|
||||
* @param string $key
|
||||
* @param string $errorMessage
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessage()
|
||||
*/
|
||||
public function canSeeFormErrorMessage($key, $errorMessage) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFormErrorMessage', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error message is set in the view.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessage('username', 'Invalid Username');
|
||||
* ?>
|
||||
* ```
|
||||
* @param string $key
|
||||
* @param string $errorMessage
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessage()
|
||||
*/
|
||||
public function seeFormErrorMessage($key, $errorMessage) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFormErrorMessage', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
@@ -299,12 +337,13 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Set the currently logged in user for the application.
|
||||
* Takes either `UserInterface` instance or array of credentials.
|
||||
* Takes either an object that implements the User interface or
|
||||
* an array of credentials.
|
||||
*
|
||||
* @param \Illuminate\Auth\UserInterface|array $user
|
||||
* @param \Illuminate\Contracts\Auth\User|array $user
|
||||
* @param string $driver
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel4::amLoggedAs()
|
||||
* @see \Codeception\Module\Laravel5::amLoggedAs()
|
||||
*/
|
||||
public function amLoggedAs($user, $driver = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Condition('amLoggedAs', func_get_args()));
|
||||
@@ -315,7 +354,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Logs user out
|
||||
* @see \Codeception\Module\Laravel4::logout()
|
||||
* @see \Codeception\Module\Laravel5::logout()
|
||||
*/
|
||||
public function logout() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('logout', func_get_args()));
|
||||
@@ -327,7 +366,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* Checks that user is authenticated
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::seeAuthentication()
|
||||
*/
|
||||
public function canSeeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeAuthentication', func_get_args()));
|
||||
@@ -336,7 +375,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that user is authenticated
|
||||
* @see \Codeception\Module\Laravel4::seeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::seeAuthentication()
|
||||
*/
|
||||
public function seeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeAuthentication', func_get_args()));
|
||||
@@ -348,7 +387,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* Check that user is not authenticated
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::dontSeeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeAuthentication()
|
||||
*/
|
||||
public function cantSeeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeAuthentication', func_get_args()));
|
||||
@@ -357,7 +396,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Check that user is not authenticated
|
||||
* @see \Codeception\Module\Laravel4::dontSeeAuthentication()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeAuthentication()
|
||||
*/
|
||||
public function dontSeeAuthentication() {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeAuthentication', func_get_args()));
|
||||
@@ -388,7 +427,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* @param string $class
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel4::grabService()
|
||||
* @see \Codeception\Module\Laravel5::grabService()
|
||||
*/
|
||||
public function grabService($class) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('grabService', func_get_args()));
|
||||
@@ -409,7 +448,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel4::haveRecord()
|
||||
* @see \Codeception\Module\Laravel5::haveRecord()
|
||||
*/
|
||||
public function haveRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('haveRecord', func_get_args()));
|
||||
@@ -428,7 +467,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::seeRecord()
|
||||
* @see \Codeception\Module\Laravel5::seeRecord()
|
||||
*/
|
||||
public function canSeeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeRecord', func_get_args()));
|
||||
@@ -444,7 +483,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @see \Codeception\Module\Laravel4::seeRecord()
|
||||
* @see \Codeception\Module\Laravel5::seeRecord()
|
||||
*/
|
||||
public function seeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeRecord', func_get_args()));
|
||||
@@ -465,7 +504,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel4::dontSeeRecord()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeRecord()
|
||||
*/
|
||||
public function cantSeeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeRecord', func_get_args()));
|
||||
@@ -483,7 +522,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
*
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @see \Codeception\Module\Laravel4::dontSeeRecord()
|
||||
* @see \Codeception\Module\Laravel5::dontSeeRecord()
|
||||
*/
|
||||
public function dontSeeRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeRecord', func_get_args()));
|
||||
@@ -504,7 +543,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* @param $model
|
||||
* @param array $attributes
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel4::grabRecord()
|
||||
* @see \Codeception\Module\Laravel5::grabRecord()
|
||||
*/
|
||||
public function grabRecord($model, $attributes = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('grabRecord', func_get_args()));
|
||||
@@ -1518,6 +1557,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Sets a cookie with the given name and value.
|
||||
* You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1525,13 +1565,16 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
* @param $value
|
||||
* @param $name
|
||||
* @param $val
|
||||
* @param array $params
|
||||
* @internal param $cookie
|
||||
* @internal param $value
|
||||
*
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::setCookie()
|
||||
*/
|
||||
public function setCookie($name, $val) {
|
||||
public function setCookie($name, $val, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1540,13 +1583,15 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Grabs a cookie value.
|
||||
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::grabCookie()
|
||||
*/
|
||||
public function grabCookie($name) {
|
||||
public function grabCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1555,6 +1600,7 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that a cookie with the given name is set.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1563,18 +1609,19 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
||||
*/
|
||||
public function canSeeCookie($name) {
|
||||
public function canSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that a cookie with the given name is set.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@@ -1583,11 +1630,11 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* ```
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
||||
*/
|
||||
public function seeCookie($name) {
|
||||
public function seeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1596,27 +1643,31 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that there isn't a cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
||||
*/
|
||||
public function cantSeeCookie($name) {
|
||||
public function cantSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that there isn't a cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
||||
*/
|
||||
public function dontSeeCookie($name) {
|
||||
public function dontSeeCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
|
||||
}
|
||||
|
||||
@@ -1625,13 +1676,15 @@ class IntegrationTester extends \Codeception\Actor
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Unsets cookie with the given name.
|
||||
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
||||
*
|
||||
* @param $cookie
|
||||
*
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::resetCookie()
|
||||
*/
|
||||
public function resetCookie($name) {
|
||||
public function resetCookie($name, $params = null) {
|
||||
return $this->scenario->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php //[STAMP] 4f61f396dfd2c13f154c1be4d8245c48
|
||||
<?php //[STAMP] ee2ab7cabfab0d617b65bfcb0547943f
|
||||
|
||||
// This class was automatically generated by build task
|
||||
// You should not change it manually as it will be overwritten on next build
|
||||
|
Reference in New Issue
Block a user