Commit a977c7af authored by Viral Solani's avatar Viral Solani

- Remove browser Kit Testing Dependencey

- Remove Feature test cases
parent 14304d6d
......@@ -8,16 +8,16 @@
"packages": [
{
"name": "arcanedev/log-viewer",
"version": "4.7.0",
"version": "4.7.1",
"source": {
"type": "git",
"url": "https://github.com/ARCANEDEV/LogViewer.git",
"reference": "3cb039a166d644894def0776d4fb94d8b920e2dc"
"reference": "fb9d1ac1ad6c0616c6c0e244c2cb42286554643a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ARCANEDEV/LogViewer/zipball/3cb039a166d644894def0776d4fb94d8b920e2dc",
"reference": "3cb039a166d644894def0776d4fb94d8b920e2dc",
"url": "https://api.github.com/repos/ARCANEDEV/LogViewer/zipball/fb9d1ac1ad6c0616c6c0e244c2cb42286554643a",
"reference": "fb9d1ac1ad6c0616c6c0e244c2cb42286554643a",
"shasum": ""
},
"require": {
......@@ -71,7 +71,7 @@
"log-viewer",
"logviewer"
],
"time": "2019-02-27T19:05:04+00:00"
"time": "2019-03-19T18:28:51+00:00"
},
{
"name": "arcanedev/no-captcha",
......@@ -862,16 +862,16 @@
},
{
"name": "erusev/parsedown",
"version": "1.7.1",
"version": "v1.7.2",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1"
"reference": "d60bcdc46978357759ecb13cb4b078da783f8faf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1",
"reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/d60bcdc46978357759ecb13cb4b078da783f8faf",
"reference": "d60bcdc46978357759ecb13cb4b078da783f8faf",
"shasum": ""
},
"require": {
......@@ -904,7 +904,7 @@
"markdown",
"parser"
],
"time": "2018-03-08T01:11:30+00:00"
"time": "2019-03-17T17:19:46+00:00"
},
{
"name": "fideloper/proxy",
......@@ -1412,16 +1412,16 @@
},
{
"name": "laravel/framework",
"version": "v5.8.4",
"version": "v5.8.7",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "d651f8bd25c6baf7ae4913bc51f02849fad4e925"
"reference": "f12c7baf9ceee80b131e06a01d3221d9a2488670"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/d651f8bd25c6baf7ae4913bc51f02849fad4e925",
"reference": "d651f8bd25c6baf7ae4913bc51f02849fad4e925",
"url": "https://api.github.com/repos/laravel/framework/zipball/f12c7baf9ceee80b131e06a01d3221d9a2488670",
"reference": "f12c7baf9ceee80b131e06a01d3221d9a2488670",
"shasum": ""
},
"require": {
......@@ -1555,20 +1555,20 @@
"framework",
"laravel"
],
"time": "2019-03-12T13:33:14+00:00"
"time": "2019-03-21T16:54:38+00:00"
},
{
"name": "laravel/passport",
"version": "v7.2.1",
"version": "v7.2.2",
"source": {
"type": "git",
"url": "https://github.com/laravel/passport.git",
"reference": "bd8ae09775778f96b6642d87e2f579fea5bf92b5"
"reference": "c0c3fca80d8f5af90dcbf65e62bdd1abee9ac25d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/passport/zipball/bd8ae09775778f96b6642d87e2f579fea5bf92b5",
"reference": "bd8ae09775778f96b6642d87e2f579fea5bf92b5",
"url": "https://api.github.com/repos/laravel/passport/zipball/c0c3fca80d8f5af90dcbf65e62bdd1abee9ac25d",
"reference": "c0c3fca80d8f5af90dcbf65e62bdd1abee9ac25d",
"shasum": ""
},
"require": {
......@@ -1587,7 +1587,7 @@
"php": ">=7.1",
"phpseclib/phpseclib": "^2.0",
"symfony/psr-http-message-bridge": "~1.0",
"zendframework/zend-diactoros": "~1.0"
"zendframework/zend-diactoros": "~1.0|~2.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
......@@ -1625,7 +1625,7 @@
"oauth",
"passport"
],
"time": "2019-03-12T11:42:07+00:00"
"time": "2019-03-13T14:21:06+00:00"
},
{
"name": "laravel/socialite",
......@@ -2233,16 +2233,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.16.0",
"version": "2.16.1",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "dd16fedc022180ea4292a03aabe95e9895677911"
"reference": "b509524136d579f6b15ad9af4e5bd4533d1ab6c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/dd16fedc022180ea4292a03aabe95e9895677911",
"reference": "dd16fedc022180ea4292a03aabe95e9895677911",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/b509524136d579f6b15ad9af4e5bd4533d1ab6c2",
"reference": "b509524136d579f6b15ad9af4e5bd4533d1ab6c2",
"shasum": ""
},
"require": {
......@@ -2289,7 +2289,7 @@
"datetime",
"time"
],
"time": "2019-03-12T09:31:40+00:00"
"time": "2019-03-20T12:20:01+00:00"
},
{
"name": "nikic/php-parser",
......@@ -2639,6 +2639,58 @@
],
"time": "2017-02-14T16:28:37+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/378bfe27931ecc54ff824a20d6f6bfc303bbd04c",
"reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"time": "2018-07-30T21:54:04+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
......@@ -3608,16 +3660,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
"reference": "82ebae02209c21113908c229e9883c419720738a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
"reference": "82ebae02209c21113908c229e9883c419720738a",
"shasum": ""
},
"require": {
......@@ -3629,7 +3681,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
"dev-master": "1.11-dev"
}
},
"autoload": {
......@@ -3662,20 +3714,20 @@
"polyfill",
"portable"
],
"time": "2018-08-06T14:22:27+00:00"
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "97001cfc283484c9691769f51cdf25259037eba2"
"reference": "f037ea22acfaee983e271dd9c3b8bb4150bd8ad7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/97001cfc283484c9691769f51cdf25259037eba2",
"reference": "97001cfc283484c9691769f51cdf25259037eba2",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f037ea22acfaee983e271dd9c3b8bb4150bd8ad7",
"reference": "f037ea22acfaee983e271dd9c3b8bb4150bd8ad7",
"shasum": ""
},
"require": {
......@@ -3687,7 +3739,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
"dev-master": "1.11-dev"
}
},
"autoload": {
......@@ -3721,20 +3773,20 @@
"portable",
"shim"
],
"time": "2018-09-21T06:26:08+00:00"
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "89de1d44f2c059b266f22c9cc9124ddc4cd0987a"
"reference": "c766e95bec706cdd89903b1eda8afab7d7a6b7af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/89de1d44f2c059b266f22c9cc9124ddc4cd0987a",
"reference": "89de1d44f2c059b266f22c9cc9124ddc4cd0987a",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c766e95bec706cdd89903b1eda8afab7d7a6b7af",
"reference": "c766e95bec706cdd89903b1eda8afab7d7a6b7af",
"shasum": ""
},
"require": {
......@@ -3783,20 +3835,20 @@
"portable",
"shim"
],
"time": "2018-09-30T16:36:12+00:00"
"time": "2019-03-04T13:44:35+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
"reference": "fe5e94c604826c35a32fa832f35bd036b6799609"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
"reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609",
"reference": "fe5e94c604826c35a32fa832f35bd036b6799609",
"shasum": ""
},
"require": {
......@@ -3808,7 +3860,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
"dev-master": "1.11-dev"
}
},
"autoload": {
......@@ -3842,20 +3894,20 @@
"portable",
"shim"
],
"time": "2018-09-21T13:07:52+00:00"
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631"
"reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
"reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/ab50dcf166d5f577978419edd37aa2bb8eabce0c",
"reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c",
"shasum": ""
},
"require": {
......@@ -3864,7 +3916,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
"dev-master": "1.11-dev"
}
},
"autoload": {
......@@ -3897,7 +3949,7 @@
"portable",
"shim"
],
"time": "2018-09-21T13:07:52+00:00"
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "symfony/process",
......@@ -4414,16 +4466,16 @@
},
{
"name": "yajra/laravel-datatables-oracle",
"version": "v9.0.0",
"version": "v9.0.1",
"source": {
"type": "git",
"url": "https://github.com/yajra/laravel-datatables.git",
"reference": "bbc9943208e121d551fed74ad1084c4e42ccf094"
"reference": "0c5764bcb436b2ac4627246fc29970c69314be1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/bbc9943208e121d551fed74ad1084c4e42ccf094",
"reference": "bbc9943208e121d551fed74ad1084c4e42ccf094",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/0c5764bcb436b2ac4627246fc29970c69314be1e",
"reference": "0c5764bcb436b2ac4627246fc29970c69314be1e",
"shasum": ""
},
"require": {
......@@ -4481,42 +4533,45 @@
"jquery",
"laravel"
],
"time": "2019-02-27T03:04:53+00:00"
"time": "2019-03-26T05:04:50+00:00"
},
{
"name": "zendframework/zend-diactoros",
"version": "1.8.6",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "20da13beba0dde8fb648be3cc19765732790f46e"
"reference": "c3c330192bc9cc51b7e9ce968ff721dc32ffa986"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/20da13beba0dde8fb648be3cc19765732790f46e",
"reference": "20da13beba0dde8fb648be3cc19765732790f46e",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/c3c330192bc9cc51b7e9ce968ff721dc32ffa986",
"reference": "c3c330192bc9cc51b7e9ce968ff721dc32ffa986",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.1",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"ext-dom": "*",
"ext-libxml": "*",
"http-interop/http-factory-tests": "^0.5.0",
"php-http/psr7-integration-tests": "dev-master",
"phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7",
"zendframework/zend-coding-standard": "~1.0"
"phpunit/phpunit": "^7.0.2",
"zendframework/zend-coding-standard": "~1.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8.x-dev",
"dev-develop": "1.9.x-dev",
"dev-release-2.0": "2.0.x-dev"
"dev-master": "2.1.x-dev",
"dev-develop": "2.2.x-dev",
"dev-release-1.8": "1.8.x-dev"
}
},
"autoload": {
......@@ -4536,16 +4591,15 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
"BSD-3-Clause"
],
"description": "PSR HTTP Message implementations",
"homepage": "https://github.com/zendframework/zend-diactoros",
"keywords": [
"http",
"psr",
"psr-7"
],
"time": "2018-09-05T19:29:37+00:00"
"time": "2019-01-05T20:13:32+00:00"
}
],
"packages-dev": [
......@@ -4724,27 +4778,29 @@
},
{
"name": "doctrine/instantiator",
"version": "1.1.0",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda"
"reference": "a2c590166b2133a4633738648b6b064edae0814a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
"reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
"reference": "a2c590166b2133a4633738648b6b064edae0814a",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"doctrine/coding-standard": "^6.0",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "^6.2.3",
"squizlabs/php_codesniffer": "^3.0.2"
"phpbench/phpbench": "^0.13",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
......@@ -4769,12 +4825,12 @@
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
"keywords": [
"constructor",
"instantiate"
],
"time": "2017-07-22T11:58:36+00:00"
"time": "2019-03-17T17:37:11+00:00"
},
{
"name": "filp/whoops",
......@@ -5386,7 +5442,7 @@
"homepage": "https://nette.org/contributors"
}
],
"description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.",
"description": "? Nette Bootstrap: the simple way to configure and bootstrap your Nette application.",
"homepage": "https://nette.org",
"keywords": [
"bootstrapping",
......@@ -5451,7 +5507,7 @@
"homepage": "https://nette.org/contributors"
}
],
"description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.",
"description": "? Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.",
"homepage": "https://nette.org",
"keywords": [
"compiled",
......@@ -5516,7 +5572,7 @@
"homepage": "https://nette.org/contributors"
}
],
"description": "🔍 Nette Finder: find files and directories with an intuitive API.",
"description": "? Nette Finder: find files and directories with an intuitive API.",
"homepage": "https://nette.org",
"keywords": [
"filesystem",
......@@ -5576,7 +5632,7 @@
"homepage": "https://nette.org/contributors"
}
],
"description": "🍸 Nette NEON: encodes and decodes NEON file format.",
"description": "? Nette NEON: encodes and decodes NEON file format.",
"homepage": "http://ne-on.org",
"keywords": [
"export",
......@@ -5589,25 +5645,22 @@
},
{
"name": "nette/php-generator",
"version": "v3.2.1",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/nette/php-generator.git",
"reference": "9de4e093a130f7a1bd175198799ebc0efbac6924"
"reference": "acff8b136fad84b860a626d133e791f95781f9f5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/php-generator/zipball/9de4e093a130f7a1bd175198799ebc0efbac6924",
"reference": "9de4e093a130f7a1bd175198799ebc0efbac6924",
"url": "https://api.github.com/repos/nette/php-generator/zipball/acff8b136fad84b860a626d133e791f95781f9f5",
"reference": "acff8b136fad84b860a626d133e791f95781f9f5",
"shasum": ""
},
"require": {
"nette/utils": "^2.4.2 || ~3.0.0",
"php": ">=7.1"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "^2.0",
"tracy/tracy": "^2.3"
......@@ -5647,7 +5700,7 @@
"php",
"scaffolding"
],
"time": "2018-11-27T19:00:14+00:00"
"time": "2019-03-15T03:41:13+00:00"
},
{
"name": "nette/robot-loader",
......@@ -5703,7 +5756,7 @@
"homepage": "https://nette.org/contributors"
}
],
"description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.",
"description": "? Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.",
"homepage": "https://nette.org",
"keywords": [
"autoload",
......@@ -5776,7 +5829,7 @@
"homepage": "https://nette.org/contributors"
}
],
"description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.",
"description": "? Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.",
"homepage": "https://nette.org",
"keywords": [
"array",
......@@ -6392,16 +6445,16 @@
},
{
"name": "phpstan/phpstan",
"version": "0.11.3",
"version": "0.11.5",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "e4644b4a8fd393c346f1137305fb2f76a7dc20a7"
"reference": "24ce5a566a798b81343138ed5d41d6877554cf9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e4644b4a8fd393c346f1137305fb2f76a7dc20a7",
"reference": "e4644b4a8fd393c346f1137305fb2f76a7dc20a7",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/24ce5a566a798b81343138ed5d41d6877554cf9a",
"reference": "24ce5a566a798b81343138ed5d41d6877554cf9a",
"shasum": ""
},
"require": {
......@@ -6461,7 +6514,7 @@
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"time": "2019-03-10T16:25:30+00:00"
"time": "2019-03-25T16:40:09+00:00"
},
{
"name": "phpunit/php-code-coverage",
......@@ -6717,16 +6770,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.5.6",
"version": "7.5.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9"
"reference": "eb343b86753d26de07ecba7868fa983104361948"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9",
"reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/eb343b86753d26de07ecba7868fa983104361948",
"reference": "eb343b86753d26de07ecba7868fa983104361948",
"shasum": ""
},
"require": {
......@@ -6744,7 +6797,7 @@
"phpunit/php-code-coverage": "^6.0.7",
"phpunit/php-file-iterator": "^2.0.1",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^2.0",
"phpunit/php-timer": "^2.1",
"sebastian/comparator": "^3.0",
"sebastian/diff": "^3.0",
"sebastian/environment": "^4.0",
......@@ -6797,7 +6850,7 @@
"testing",
"xunit"
],
"time": "2019-02-18T09:24:50+00:00"
"time": "2019-03-16T07:31:17+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
......
<?php
namespace Tests\Feature\Api\V1;
use Tests\TestCase;
class LoginTest extends TestCase
{
/** @test */
public function users_can_login_through_api()
{
$res = $this->json('POST', '/api/v1/auth/login', [
'email' => $this->user->email,
'password' => '1234',
])
->assertStatus(200)
->assertJsonStructure([
'message',
'token',
]);
}
}
<?php
namespace Tests\Feature\Api\V1;
use App\Models\Access\User\User;
use App\Models\Page\Page;
use JWTAuth;
use Tests\TestCase;
class PageTest extends TestCase
{
public $token = '';
public $headers = '';
public $user = '';
public function setUp(): void
{
parent::setUp();
$this->user = User::find(1);
$this->token = JWTAuth::fromUser($this->user);
$this->headers = ['Authorization' => 'Bearer '.$this->token];
}
/**
* A basic test example.
*/
public function testExample()
{
$this->assertTrue(true);
}
/**
* A basic test to get response form pages api.
*/
/** @test */
public function Get_records_from_pages()
{
$payload = [];
$response = $this->json('GET', '/api/v1/pages', $payload, $this->headers);
$response
->assertStatus(200)
->assertJsonStructure([
'data' => [
[
'id',
'title',
'status_label',
'status',
'created_at',
'created_by',
],
],
'links',
'meta',
]);
}
/**
* A basic test to get response form pages api.
*/
/** @test */
public function get_one_created_page_from_db()
{
$page = create(Page::class);
$payload = [];
$response = $this->json('GET', '/api/v1/pages/'.$page->id, $payload, $this->headers);
$response
->assertStatus(200)
->assertJson([
'data' => [
'id' => $page->id,
'title' => $page->title,
'status_label' => $page->status_label,
'status' => ($page->isActive()) ? 'Active' : 'InActive',
'created_by' => $page->created_by,
],
]);
}
/**
* Author: Indra Shastri
* Date:03-03-2018
* A basic test to update a page from api.
*/
/** @test */
public function update_a_page_in_db_and_get_response()
{
$page = make(Page::class);
$payload = [
'title' => $page->title,
'description' => $page->description,
'cannonical_link' => $page->cannonical_link,
'seo_title' => 'some tittle',
'seo_keyword' => 'some keywords',
'seo_description' => '<p>&nbsp;</p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p>',
'status' => '1',
];
$response = '';
$response = $this->json('PUT', '/api/v1/pages/1', $payload, $this->headers);
$response->assertStatus(200);
$response->assertJson([
'data' => [
'title' => $page->title,
'status_label' => $page->status_label,
'status' => ($page->isActive()) ? 'Active' : 'InActive',
'created_by' => ''.$this->user->id,
],
]);
}
/**
* Author: Indra Shastri
* Date:03-03-2018
* A basic test to create a page from api.
*/
/** @test */
public function create_a_new_page_in_db_and_get_response()
{
$page = make(Page::class);
$payload = [
'title' => $page->title,
'description' => $page->description,
'cannonical_link' => $page->cannonical_link,
'seo_title' => 'some tittle',
'seo_keyword' => 'some keywords',
'seo_description' => '<p>&nbsp;</p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p>',
'status' => '1',
];
$response = '';
$response = $this->json('POST', '/api/v1/pages', $payload, $this->headers);
$response->assertStatus(201);
$response->assertJson([
'data' => [
'title' => $page->title,
'status_label' => $page->status_label,
'status' => ($page->isActive()) ? 'Active' : 'InActive',
'created_by' => $this->user->first_name,
'created_at' => (\Carbon\Carbon::now())->toDateString(),
],
]);
}
/**
* Author: Indra Shastri
* Date:03-03-2018
* A basic test to create a page from api.
*/
/** @test */
public function delete_page_in_db_and_get_response()
{
$page = create(Page::class);
$payload = [];
$response = $this->json('DELETE', '/api/v1/pages/'.$page->id, $payload, $this->headers);
$response->assertStatus(200)
->assertJson([
'message' => 'The Page was successfully deleted.',
]);
}
}
<?php
namespace Tests\Feature\Auth;
use App\Events\Frontend\Auth\UserLoggedIn;
use App\Models\Access\User\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
use Tests\BrowserKitTestCase;
class LoginTest extends BrowserKitTestCase
{
/** @test */
public function login_page_loads_properly()
{
$this->visit('/login')
->see('Email')
->see('Password')
->see('Login')
->dontSee('You are logged in!');
}
/** @test */
public function login_fails_when_a_required_field_is_not_filled_in()
{
$this->visit('/login')
->type('', 'email')
->type('', 'password')
->press('Login')
->seePageIs('/login')
->see('The email field is required.')
->see('The password field is required.');
}
/** @test */
public function login_fails_when_password_is_incorrect()
{
$this->visit('/login')
->type('admin@admin.com', 'email')
->type('invalidpass', 'password')
->press('Login')
->seePageIs('/login')
->see('These credentials do not match our records.');
}
/** @test */
public function login_failure_with_wrong_inputs()
{
$this->visit('/login')
->type('wrongusername@wrongpassword.com', 'email')
->type('wrongpassword', 'password')
->press('Login')
->seePageIs('/login')
->see('These credentials do not match our records.');
}
/** @test */
public function unconfirmed_users_can_not_logIn()
{
Auth::logout();
config(['access.users.requires_approval' => false]);
// Create default user to test with
$unconfirmed = factory(User::class)->states('unconfirmed')->create();
$unconfirmed->attachRole(3); //User
$this->visit('/login')
->type($unconfirmed->email, 'email')
->type('secret', 'password')
->press('Login')
->seePageIs('/login')
->see('Your account is not confirmed.');
}
/** @test **/
public function inactive_users_can_not_login()
{
Auth::logout();
// Create default user to test with
$inactive = factory(User::class)->states('confirmed', 'inactive')->create();
$inactive->attachRole(3); //User
$this->visit('/login')
->type($inactive->email, 'email')
->type('secret', 'password')
->press('Login')
->seePageIs('/login')
->see('Your account has been deactivated.');
}
/** @test */
public function users_can_login()
{
// Make sure our events are fired
Event::fake();
Auth::logout();
//User Test
$this->visit('/login')
->type($this->user->email, 'email')
->type('1234', 'password')
->press('Login')
->see($this->user->name)
->seePageIs('/dashboard');
$this->assertLoggedIn();
Auth::logout();
//Admin Test
$this->visit('/login')
->type($this->admin->email, 'email')
->type('1234', 'password')
->press('Login')
->seePageIs('/admin/dashboard')
->see($this->admin->first_name)
->see('Access Management');
$this->assertLoggedIn();
Event::assertDispatched(UserLoggedIn::class);
}
}
<?php
namespace Tests\Feature\Auth;
use App\Events\Frontend\Auth\UserRegistered;
use App\Models\Access\User\User;
use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
use Tests\BrowserKitTestCase;
class RegistrationTest extends BrowserKitTestCase
{
/** @test */
public function registration_page_loads_properly()
{
$this->visit('/register')
->see('first_name')
->see('last_name')
->see('email')
->see('password')
->see('is_term_accept')
->see('Register');
}
/** @test */
public function registration_fails_when_a_required_field_is_not_filled_in()
{
$this->visit('/register')
->type('', 'first_name')
->type('', 'last_name')
->type('', 'email')
->type('', 'password')
->press('Register')
->seePageIs('/register')
->see('The first name field is required.')
->see('The last name field is required.')
->see('The email field is required.')
->see('The password field is required.')
->see('The is term accept field is required.');
}
/**
* Test the registration form
* Test it works with confirming email on or off, and that the confirm email notification is sent
* Note: Captcha is disabled by default in phpunit.xml.
*/
/** @test */
public function user_can_register()
{
// Make sure our events are fired
Event::fake();
config(['access.users.confirm_email' => false]);
config(['access.users.requires_approval' => false]);
$this->visit('/register')
->type('John', 'first_name')
->type('Doe', 'last_name')
->type('john.doe@example.com', 'email')
->type('Viral@1234', 'password')
->type('Viral@1234', 'password_confirmation')
->check('is_term_accept')
->press('Register')
->seePageIs('/')
->seeInDatabase(config('access.users_table'),
[
'email' => 'john.doe@example.com',
'first_name' => 'John',
'last_name' => 'Doe',
'confirmed' => 1,
]);
Event::assertDispatched(UserRegistered::class);
}
/**
* Test the registration form when account are set to be pending an approval
* ensure they are registered but not confirmed.
*/
/** @test */
public function registration_for_pending_approval()
{
Event::fake();
Notification::fake();
// Set registration to pending approval
config(['access.users.confirm_email' => false]);
config(['access.users.requires_approval' => true]);
$this->visit('/register')
->type('first name', 'first_name')
->type('last name', 'last_name')
->type('test@example.com', 'email')
->type('Viral@1234', 'password')
->type('Viral@1234', 'password_confirmation')
->check('is_term_accept')
->press('Register')
->see('Your account was successfully created and is pending approval. An e-mail will be sent when your account is approved.')
->see('Login')
->seePageIs('/')
->seeInDatabase(config('access.users_table'),
[
'email' => 'test@example.com',
'first_name' => 'first name',
'last_name' => 'last name',
'confirmed' => 0,
]);
// Get the user that was inserted into the database
$user = User::where('email', 'test@example.com')->first();
Notification::assertNotSentTo([$user], UserNeedsConfirmation::class);
Event::assertDispatched(UserRegistered::class);
}
}
<?php
namespace Tests\Feature\Auth;
use App\Notifications\Frontend\Auth\UserNeedsPasswordReset;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Tests\BrowserKitTestCase;
class ResetPasswordTest extends BrowserKitTestCase
{
/** @test */
public function forgot_password_page_loads_properly()
{
$this->visit('/password/reset')
->see('Email')
->see('Reset Password');
}
/** @test **/
public function forgot_password_fails_when_a_required_field_is_not_filled_in()
{
$this->visit('/password/reset')
->type('', 'email')
->press('Send Password Reset Link')
->seePageIs('/password/reset')
->see('The email field is required.');
}
/** @test **/
public function users_can_request_a_password_reset_link()
{
Notification::fake();
$this->visit('password/reset')
->type($this->user->email, 'email')
->press('Send Password Reset Link')
->seePageIs('password/reset')
->see('We have e-mailed your password reset link!')
->seeInDatabase('password_resets', ['email' => $this->user->email]);
Notification::assertSentTo(
[$this->user],
UserNeedsPasswordReset::class
);
}
/** @test **/
public function reset_password_fails_when_a_required_field_is_not_filled_in()
{
$token = $this->app->make('auth.password.broker')->createToken($this->user);
$this->visit('password/reset/'.$token)
->see($this->user->email)
->type('', 'password')
->type('', 'password_confirmation')
->press('Reset Password')
->see('The password field is required.');
}
/** @test **/
public function users_can_reset_password()
{
$token = $this->app->make('auth.password.broker')->createToken($this->user);
$this->visit('password/reset/'.$token)
->see($this->user->email)
->type('12345678', 'password')
->type('12345678', 'password_confirmation')
->press('Reset Password')
->see($this->user->first_name);
}
}
<?php
namespace Tests\Feature\Backend;
use App\Events\Backend\Access\User\UserPasswordChanged;
use Illuminate\Support\Facades\Event;
use Tests\TestCase;
class ChangePasswordTest extends TestCase
{
/** @test */
public function a_user_require_old_password_to_change_password()
{
$data = [];
$data['old_password'] = '12345';
$data['password'] = 'Viral@1234';
$data['password_confirmation'] = 'Viral@1234';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.access.user.change-password', $this->admin), $data)
->assertSessionHas(['flash_danger' => trans('exceptions.backend.access.users.change_mismatch')]);
}
/** @test */
/*public function a_user_require_strong_password_to_change_password()
{
$data = [];
$data['old_password'] = '1234';
$data['password'] = '12345678';
$data['password_confirmation'] = '12345678';
$this->withExceptionHandling()
->actingAs($this->executive)
->patch(route('admin.access.user.change-password', $this->executive), $data)
->assertSessionHas('The given data was invalid.');
}*/
/** @test */
public function a_user_can_change_password()
{
Event::fake();
$data = [];
$data['old_password'] = '1234';
$data['password'] = 'Viral@1234';
$data['password_confirmation'] = 'Viral@1234';
$this->actingAs($this->admin)
->patch(route('admin.access.user.change-password', $this->admin), $data)
->assertSessionHas(['flash_success' => trans('alerts.backend.users.updated_password')]);
Event::assertDispatched(UserPasswordChanged::class);
}
}
<?php
namespace Tests\Feature\Backend\History;
use Tests\BrowserKitTestCase;
/**
* Class HistoryLogTest.
*/
class HistoryLogTest extends BrowserKitTestCase
{
/** @test **/
public function history_log_by_type_name_function()
{
$this->actingAs($this->admin);
history()
->withType('User')
->withText(trans('history.backend.users.created').$this->user->name)
->withEntity($this->user->id)
->withIcon('plus')
->withClass('bg-green')
->log();
$this->seeInDatabase('history',
[
'type_id' => 1,
'user_id' => $this->admin->id,
'entity_id' => $this->user->id,
'icon' => 'plus',
'class' => 'bg-green',
'text' => trans('history.backend.users.created').$this->user->name,
])
->visit('/admin/dashboard')
->see('<strong>'.$this->admin->name.'</strong> '.trans('history.backend.users.created').$this->user->name);
}
/** @test **/
public function history_log_By_TypeId_Function()
{
$this->actingAs($this->admin);
history()
->withType(1)
->withText(trans('history.backend.users.created').$this->user->name)
->withEntity($this->user->id)
->withIcon('plus')
->withClass('bg-green')
->log();
$this->seeInDatabase('history',
[
'type_id' => 1,
'user_id' => $this->admin->id,
'entity_id' => $this->user->id,
'icon' => 'plus',
'class' => 'bg-green',
'text' => trans('history.backend.users.created').$this->user->name,
])
->visit('/admin/dashboard')
->see('<strong>'.$this->admin->name.'</strong> '.trans('history.backend.users.created').$this->user->name);
}
}
<?php
namespace Tests\Feature\Backend\History;
use App\Models\Access\User\User;
use Tests\BrowserKitTestCase;
/**
* Class HistoryRenderEntityTest.
*/
class HistoryRenderEntityTest extends BrowserKitTestCase
{
/** @test **/
public function users_can_see_history_of_entity()
{
$this->actingAs($this->admin);
$test_user = factory(User::class)->create();
history()
->withType('User')
->withText('trans("history.backend.users.created") '.$this->user->name)
->withEntity($this->user->id)
->withIcon('plus')
->withClass('bg-green')
->log();
history()
->withType('User')
->withText('trans("history.backend.users.updated") '.$this->user->name)
->withEntity($this->user->id)
->withIcon('pencil')
->withClass('bg-blue')
->log();
history()
->withType('User')
->withText('trans("history.backend.users.deleted") '.$this->user->name)
->withEntity($this->user->id)
->withIcon('trash')
->withClass('bg-red')
->log();
history()
->withType('User')
->withText('trans("history.backend.roles.created") '.$test_user->name)
->withEntity($test_user->id)
->withIcon('plus')
->withClass('bg-red')
->log();
history()
->withType('User')
->withText('trans("history.backend.roles.updated") '.$test_user->name)
->withEntity($test_user->id)
->withIcon('pencil')
->withClass('bg-red')
->log();
history()
->withType('User')
->withText('trans("history.backend.roles.deleted") '.$test_user->name)
->withEntity($test_user->id)
->withIcon('trash')
->withClass('bg-red')
->log();
$this->visit('/admin/access/user/'.$this->user->id)
->see('<strong>'.$this->admin->name.'</strong> created user '.$this->user->name)
->see('<strong>'.$this->admin->name.'</strong> updated user '.$this->user->name)
->see('<strong>'.$this->admin->name.'</strong> deleted user '.$this->user->name)
->dontSee('<strong>'.$this->admin->name.'</strong> created user '.$test_user->name)
->dontSee('<strong>'.$this->admin->name.'</strong> updated user '.$test_user->name)
->dontSee('<strong>'.$this->admin->name.'</strong> deleted user '.$test_user->name);
}
}
<?php
namespace Tests\Feature\Backend\History;
use Tests\BrowserKitTestCase;
/**
* Class HistoryRenderTest.
*/
class HistoryRenderTest extends BrowserKitTestCase
{
/** @test **/
public function admin_users_can_see_history_on_dashboard()
{
$this->actingAs($this->admin);
history()
->withType('User')
->withText(trans('history.backend.users.created').$this->user->name)
->withEntity($this->user->id)
->withIcon('plus')
->withClass('bg-green')
->log();
$this->visit('/admin/dashboard')
->see('<strong>'.$this->admin->name.'</strong> '.trans('history.backend.users.created').$this->user->name);
}
/** @test **/
public function admin_users_can_see_history_on_user_show_page()
{
$this->actingAs($this->admin);
history()
->withType('User')
->withText(trans('history.backend.users.created').$this->user->name)
->withEntity($this->user->id)
->withIcon('plus')
->withClass('bg-green')
->log();
$this->visit('/admin/access/user/3')
->see('<strong>'.$this->admin->name.'</strong> '.trans('history.backend.users.created').$this->user->name);
}
}
<?php
namespace Tests\Feature\Backend;
use Tests\BrowserKitTestCase;
/**
* Class LogViewerRouteTest.
*/
class LogViewerRouteTest extends BrowserKitTestCase
{
/** @test **/
public function admin_users_can_see_logviewer_dashboard()
{
$this->actingAs($this->admin)
->visit('/admin/log-viewer')
->see('LogViewer');
}
/** @test **/
public function admin_users_can_see_logviewer_list()
{
$this->actingAs($this->admin)
->visit('/admin/log-viewer/logs')
->see('Logs');
}
/* @test **/
/*public function admin_users_can_see_logviewer_single_date()
{
$this->actingAs($this->admin)
->visit('/admin/log-viewer/logs/'.date('Y-m-d'))
->see('Log ['.date('Y-m-d').']');
}*/
/* @test **/
/*public function admin_users_can_see_logviewer_single_date_type()
{
$this->actingAs($this->admin)
->visit('/admin/log-viewer/logs/'.date('Y-m-d').'/error')
->see('Log ['.date('Y-m-d').']');
}*/
}
<?php
namespace Tests\Feature\Backend;
use App\Models\BlogCategories\BlogCategory;
use Tests\TestCase;
class ManageBlogCategoriesTest extends TestCase
{
/** @test */
public function a_user_can_view_blog_categories_index_page()
{
$this->actingAs($this->admin)
->get(route('admin.blogCategories.index'))
->assertViewIs('backend.blogcategories.index')
->assertSee(trans('labels.backend.blogcategories.management'))
->assertSee(trans('labels.backend.blogcategories.table.title'))
->assertSee(trans('labels.backend.blogcategories.table.status'))
->assertSee('Action');
}
/** @test */
public function a_user_can_create_a_blog_category()
{
$this->actingAs($this->admin);
$category = make(BlogCategory::class);
$this->post(route('admin.blogCategories.store'), $category->toArray());
$this->assertDatabaseHas(config('module.blog_categories.table'), ['name' => $category->name]);
}
/** @test */
public function a_blog_category_requires_a_name_while_creating()
{
$this->actingAs($this->admin)->withExceptionHandling();
$category = make(BlogCategory::class, ['name' => '']);
$this->post(route('admin.blogCategories.store'), $category->toArray())
->assertSessionHasErrors('name');
}
/** @test */
public function a_blog_category_requires_a_name_while_updating()
{
$this->actingAs($this->admin)->withExceptionHandling();
$category = create(BlogCategory::class);
$this->patch(route('admin.blogCategories.update', $category), ['name' => ''])
->assertSessionHasErrors('name');
}
/** @test */
public function a_user_can_update_a_blog_category()
{
$this->actingAs($this->admin);
$category = create(BlogCategory::class);
$this->patch(route('admin.blogCategories.update', $category), ['name' => 'New Category']);
$this->assertDatabaseHas(config('module.blog_categories.table'), ['name' => 'New Category', 'id' => $category->id]);
}
/** @test */
public function a_user_can_delete_a_blog_category()
{
$this->actingAs($this->admin);
$category = create(BlogCategory::class);
$this->delete(route('admin.blogCategories.destroy', $category));
$this->assertDatabaseMissing(config('module.blog_categories.table'), ['name' => $category->name, 'id' => $category->id, 'deleted_at' => null]);
}
/** @test */
public function a_user_can_not_update_a_blog_category_with_same_name()
{
$this->actingAs($this->admin)->withExceptionHandling();
$catCategory = create(BlogCategory::class, ['name' => 'Cat']);
$dogCategory = create(BlogCategory::class, ['name' => 'Dog']);
$this->patch(route('admin.blogCategories.update', $dogCategory),
['name' => 'Cat']
)->assertSessionHasErrors('name');
}
}
<?php
namespace Tests\Feature\Backend;
use App\Models\BlogTags\BlogTag;
use Tests\TestCase;
class ManageBlogTagsTest extends TestCase
{
/** @test */
public function a_user_can_view_blog_tags_index_page()
{
$this->actingAs($this->admin)
->get(route('admin.blogTags.index'))
->assertViewIs('backend.blogtags.index')
->assertSee(trans('labels.backend.blogtags.management'))
->assertSee(trans('labels.backend.blogtags.table.title'))
->assertSee(trans('labels.backend.blogtags.table.status'))
->assertSee('Action');
}
/** @test */
public function a_user_can_create_a_blog_tag()
{
$this->actingAs($this->admin);
$tag = make(BlogTag::class);
$this->post(route('admin.blogTags.store'), $tag->toArray());
$this->assertDatabaseHas(config('module.blog_tags.table'), ['name' => $tag->name]);
}
/** @test */
public function a_blog_tag_requires_a_name_while_creating()
{
$this->actingAs($this->admin)->withExceptionHandling();
$tag = make(BlogTag::class, ['name' => '']);
$this->post(route('admin.blogTags.store'), $tag->toArray())
->assertSessionHasErrors('name');
}
/** @test */
public function a_blog_tag_requires_a_name_while_updating()
{
$this->actingAs($this->admin)->withExceptionHandling();
$tag = create(BlogTag::class);
$this->patch(route('admin.blogTags.update', $tag), ['name' => ''])
->assertSessionHasErrors('name');
}
/** @test */
public function a_user_can_update_a_blog_tag()
{
$this->actingAs($this->admin);
$tag = create(BlogTag::class);
$this->patch(route('admin.blogTags.update', $tag), ['name' => 'New Tag']);
$this->assertDatabaseHas(config('module.blog_tags.table'), ['name' => 'New Tag', 'id' => $tag->id]);
}
/** @test */
public function a_user_can_delete_a_blog_tag()
{
$this->actingAs($this->admin);
$tag = create(BlogTag::class);
$this->delete(route('admin.blogTags.destroy', $tag));
$this->assertDatabaseMissing(config('module.blog_tags.table'), ['name' => $tag->name, 'id' => $tag->id, 'deleted_at' => null]);
}
/** @test */
public function a_user_can_not_update_a_blog_tag_with_same_name()
{
$this->actingAs($this->admin)->withExceptionHandling();
$catTag = create(BlogTag::class, ['name' => 'Cat']);
$dogTag = create(BlogTag::class, ['name' => 'Dog']);
$this->patch(route('admin.blogTags.update', $dogTag),
['name' => 'Cat']
)->assertSessionHasErrors('name');
}
}
<?php
namespace Tests\Feature\Backend;
use App\Models\Blogs\Blog;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class ManageBlogsTest extends TestCase
{
use WithFaker;
protected $blog;
protected $categories;
protected $tags;
public function setUp(): void
{
parent::setUp();
$this->actingAs($this->admin);
$this->blog = create(Blog::class);
$this->categories = [$this->faker->word, $this->faker->word];
$this->tags = [$this->faker->word, $this->faker->word];
}
/** @test */
public function a_user_can_view_blogs_index_page()
{
$this->actingAs($this->admin)
->get(route('admin.blogs.index'))
->assertViewIs('backend.blogs.index')
->assertSee(trans('labels.backend.blogs.management'))
->assertSee(trans('labels.backend.blogs.table.title'))
->assertSee(trans('labels.backend.blogs.table.publish'))
->assertSee(trans('labels.backend.blogs.table.createdby'))
->assertSee(trans('labels.backend.blogs.table.createdat'))
->assertSee(trans('labels.backend.blogs.table.status'))
->assertSee('Action');
}
/** @test */
public function a_user_can_create_a_blog()
{
$blog = make(Blog::class, [
'featured_image' => UploadedFile::fake()->image('logo.jpg'),
'categories' => $this->categories,
'tags' => $this->tags,
]);
$this->post(route('admin.blogs.store'), $blog->toArray());
$this->assertDatabaseHas(config('module.blogs.table'), ['name' => $blog->name, 'status' => $blog->status]);
//Assert Tags have been saved
$this->assertDatabaseHas(config('module.blog_tags.table'), ['name' => $this->tags[0]]);
$this->assertDatabaseHas(config('module.blog_tags.table'), ['name' => $this->tags[1]]);
//Assert Categories have been saved
$this->assertDatabaseHas(config('module.blog_categories.table'), ['name' => $this->categories[0]]);
$this->assertDatabaseHas(config('module.blog_categories.table'), ['name' => $this->categories[1]]);
}
public function makeBlog($overrides = [])
{
$this->withExceptionHandling();
$blog = make(Blog::class, $overrides);
return $blog;
}
/** @test */
public function it_requires_name_while_creating()
{
$blog = $this->makeBlog(['name' => '']);
$this->post(route('admin.blogs.store'), $blog->toArray())
->assertSessionHasErrors('name');
}
/** @test */
public function it_requires_content_while_creating()
{
$blog = $this->makeBlog(['content' => '']);
$this->post(route('admin.blogs.store'), $blog->toArray())
->assertSessionHasErrors('content');
}
/** @test */
public function it_requires_featured_image_while_creating()
{
$blog = $this->makeBlog(['featured_image' => '']);
$this->post(route('admin.blogs.store'), $blog->toArray())
->assertSessionHasErrors('featured_image');
}
/** @test */
public function it_requires_publish_datetime_while_creating()
{
$blog = $this->makeBlog();
unset($blog->publish_datetime);
$this->post(route('admin.blogs.store'), $blog->toArray())
->assertSessionHasErrors('publish_datetime');
}
/** @test */
public function it_requires_categories_while_creating()
{
$blog = $this->makeBlog(['categories' => '']);
$this->post(route('admin.blogs.store'), $blog->toArray())
->assertSessionHasErrors('categories');
}
/** @test */
public function it_requires_tags_while_creating()
{
$blog = $this->makeBlog(['tags' => '']);
$this->post(route('admin.blogs.store'), $blog->toArray())
->assertSessionHasErrors('tags');
}
/** @test */
public function it_can_store_featured_image()
{
$blog = make(Blog::class, [
'featured_image' => UploadedFile::fake()->image('logo.jpg'),
'categories' => $this->categories,
'tags' => $this->tags,
]);
$this->post(route('admin.blogs.store'), $blog->toArray());
$stored_blog = Blog::find(2);
Storage::disk('public')->assertExists('img/blog/'.$stored_blog->featured_image);
}
/** @test */
public function it_requires_name_while_updating()
{
$this->withExceptionHandling();
$this->blog->name = '';
$this->patch(route('admin.blogs.update', $this->blog), $this->blog->toArray())
->assertSessionHasErrors('name');
}
/** @test */
public function it_requires_content_while_updating()
{
$this->withExceptionHandling();
$this->blog->content = '';
$this->patch(route('admin.blogs.update', $this->blog), $this->blog->toArray())
->assertSessionHasErrors('content');
}
/** @test */
public function it_requires_publish_datetime_while_updating()
{
$this->withExceptionHandling();
unset($this->blog->publish_datetime);
$this->patch(route('admin.blogs.update', $this->blog), $this->blog->toArray())
->assertSessionHasErrors('publish_datetime');
}
/** @test */
public function it_requires_categories_while_updating()
{
$this->withExceptionHandling();
$this->patch(route('admin.blogs.update', $this->blog), $this->blog->toArray())
->assertSessionHasErrors('categories');
}
/** @test */
public function it_requires_tags_while_updating()
{
$this->withExceptionHandling();
$this->patch(route('admin.blogs.update', $this->blog), $this->blog->toArray())
->assertSessionHasErrors('tags');
}
/** @test */
public function a_user_can_update_blog()
{
$blog = make(Blog::class, [
'featured_image' => UploadedFile::fake()->image('logo.jpg'),
'name' => 'Changed Name',
'categories' => $this->categories,
'tags' => $this->tags,
]);
$this->patch(route('admin.blogs.update', $this->blog), $blog->toArray());
$this->assertDatabaseHas(config('module.blogs.table'), ['id' => $this->blog->id, 'name' => 'Changed Name']);
}
/** @test */
public function a_user_can_delete_a_blog()
{
$this->delete(route('admin.blogs.destroy', $this->blog));
$this->assertDatabaseMissing(config('module.blogs.table'), ['id' => $this->blog->id, 'deleted_at' => null]);
}
/** @test */
public function a_user_can_not_update_a_blog_with_same_name()
{
$this->actingAs($this->admin)->withExceptionHandling();
$catCategory = create(Blog::class, ['name' => 'Cat']);
$dogCategory = create(Blog::class, ['name' => 'Dog']);
$this->patch(
route('admin.blogs.update', $dogCategory),
['name' => 'Cat']
)->assertSessionHasErrors('name');
}
}
<?php
namespace Tests\Feature\Backend;
use App\Models\Faqs\Faq;
use Tests\TestCase;
class ManageFaqsTest extends TestCase
{
/** @test */
public function a_user_can_view_faqs_index_page()
{
$this->actingAs($this->admin)
->get(route('admin.faqs.index'))
->assertViewIs('backend.faqs.index')
->assertSee(trans('labels.backend.faqs.management'))
->assertSee(trans('labels.backend.faqs.table.question'))
->assertSee(trans('labels.backend.faqs.table.answer'))
->assertSee(trans('labels.backend.faqs.table.status'))
->assertSee('Action');
}
/** @test */
public function a_user_can_create_faq()
{
$faq = make(Faq::class);
$this->actingAs($this->admin)
->post(route('admin.faqs.store'), $faq->toArray());
$this->assertDatabaseHas(config('module.faqs.table'), ['question' => $faq->question, 'answer' => $faq->answer]);
}
/** @test */
public function it_requires_question_while_creating()
{
$faq = make(Faq::class, ['question' => '']);
$this->actingAs($this->admin)
->withExceptionHandling()
->post(route('admin.faqs.store'), $faq->toArray())
->assertSessionHasErrors('question');
}
/** @test */
public function it_requires_answer_while_creating()
{
$faq = make(Faq::class, ['answer' => '']);
$this->actingAs($this->admin)
->withExceptionHandling()
->post(route('admin.faqs.store'), $faq->toArray())
->assertSessionHasErrors('answer');
}
/** @test */
public function it_requires_question_while_updating()
{
$faq = create(Faq::class);
$this->actingAs($this->admin)
->withExceptionHandling()
->patch(route('admin.faqs.update', $faq), ['question' => '', 'answer' => $faq->answer])
->assertSessionHasErrors('question');
}
/** @test */
public function it_requires_answer_while_updating()
{
$faq = create(Faq::class);
$this->actingAs($this->admin)
->withExceptionHandling()
->patch(route('admin.faqs.update', $faq), ['question' => $faq->question, 'answer' => ''])
->assertSessionHasErrors('answer');
}
/** @test */
public function a_user_can_update_faq()
{
$faq = create(Faq::class);
$changed_question = 'What is Life?';
$changed_answer = $faq->answer;
$this->actingAs($this->admin)
->patch(route('admin.faqs.update', $faq), ['question' => $changed_question, 'answer' => $changed_answer]);
$this->assertDatabaseHas(config('module.faqs.table'), ['id' => $faq->id, 'question' => $changed_question, 'answer' => $changed_answer]);
}
/** @test */
public function a_user_can_delete_faq()
{
$faq = create(Faq::class);
$this->actingAs($this->admin)
->delete(route('admin.faqs.destroy', $faq));
$this->assertDatabaseMissing(config('module.faqs.table'), ['id' => $faq->id, 'deleted_at' => null]);
}
}
<?php
namespace Tests\Feature\Backend;
use App\Models\Page\Page;
use Tests\TestCase;
class ManagePagesTest extends TestCase
{
/** @test */
public function a_user_can_view_pages()
{
$this->actingAs($this->admin)
->get(route('admin.pages.index'))
->assertSee(trans('labels.backend.pages.management'))
->assertSee(trans('labels.backend.pages.table.title'))
->assertSee(trans('labels.backend.pages.table.status'))
->assertSee($this->admin->name);
}
/** @test */
public function test_create_and_edit_page_has_all_fields()
{
$this->actingAs($this->admin)
->get(route('admin.pages.create'))
->assertSee(trans('validation.attributes.backend.pages.title'))
->assertSee(trans('validation.attributes.backend.pages.description'))
->assertSee(trans('validation.attributes.backend.pages.cannonical_link'))
->assertSee(trans('validation.attributes.backend.pages.seo_title'))
->assertSee(trans('validation.attributes.backend.pages.seo_keyword'))
->assertSee(trans('validation.attributes.backend.pages.seo_description'))
->assertSee(trans('validation.attributes.backend.pages.is_active'));
$page = create(Page::class);
$this->actingAs($this->admin)
->get(route('admin.pages.edit', $page))
->assertSee(trans('validation.attributes.backend.pages.title'))
->assertSee(trans('validation.attributes.backend.pages.description'))
->assertSee(trans('validation.attributes.backend.pages.cannonical_link'))
->assertSee(trans('validation.attributes.backend.pages.seo_title'))
->assertSee(trans('validation.attributes.backend.pages.seo_keyword'))
->assertSee(trans('validation.attributes.backend.pages.seo_description'))
->assertSee(trans('validation.attributes.backend.pages.is_active'));
}
/** @test */
public function a_user_can_create_page()
{
$page = make(Page::class);
$this->actingAs($this->admin)
->post(route('admin.pages.store'), $page->toArray())
->assertRedirect(route('admin.pages.index'));
$this->assertDatabaseHas('pages', ['title' => $page->title, 'description' => $page->description]);
}
/** @test */
public function it_requires_title_on_create()
{
$page = make(Page::class, ['title' => '']);
$this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.pages.store'), $page->toArray())
->assertSessionHasErrors('title');
}
/** @test */
public function it_requires_description_while_create()
{
$page = make(Page::class, ['description' => '']);
$this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.pages.store'), $page->toArray())
->assertSessionHasErrors('description');
}
/** @test */
public function a_user_can_update_page()
{
$page = create(Page::class);
$title = 'Changed title';
$slug = str_slug($title);
$description = 'Changed Description';
$this->actingAs($this->admin)
->patch(route('admin.pages.update', $page), ['title' => $title, 'description' => $description]);
$this->assertDatabaseHas('pages', ['id' => $page->id, 'title' => $title, 'page_slug' => $slug, 'description' => $description]);
}
/** @test */
public function it_requires_title_on_update()
{
$page = create(Page::class);
$page1 = $page->toArray();
$page1['title'] = '';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.pages.update', $page), $page1)
->assertSessionHasErrors('title');
}
/** @test */
public function it_requires_description_while_update()
{
$page = create(Page::class);
$page1 = $page->toArray();
$page1['description'] = '';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.pages.update', $page), $page1)
->assertSessionHasErrors('description');
}
/** @test */
public function a_user_can_delete_a_page()
{
$this->actingAs($this->admin);
$page = create(Page::class);
$this->delete(route('admin.pages.destroy', $page));
$this->assertDatabaseMissing(config('module.pages.table'), ['name' => $page->name, 'id' => $page->id, 'deleted_at' => null]);
}
}
<?php
namespace Tests\Feature\Backend;
use App\Events\Backend\Access\Permission\PermissionCreated;
use App\Events\Backend\Access\Permission\PermissionDeleted;
use App\Events\Backend\Access\Permission\PermissionUpdated;
use App\Models\Access\Permission\Permission;
use Illuminate\Support\Facades\Event;
use Tests\TestCase;
class ManagePermissionsTest extends TestCase
{
/** @test */
public function a_user_can_view_permissions()
{
$this->actingAs($this->admin)
->get(route('admin.access.permission.index'))
->assertViewIs('backend.access.permissions.index')
->assertSee(trans('labels.backend.access.permissions.management'))
->assertSee('Action');
}
/** @test */
public function a_permission_requires_a_name()
{
$permission = make(Permission::class, ['name' => null])->toArray();
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.permission.store'), $permission)
->assertSessionHasErrors('name');
}
/** @test */
public function a_permission_requires_a_display_name()
{
$permission = make(Permission::class, ['display_name' => null])->toArray();
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.permission.store'), $permission)
->assertSessionHasErrors('display_name');
}
/** @test */
public function a_user_can_create_new_permission()
{
// Make sure our events are fired
Event::fake();
$permission = make(Permission::class, ['name' => 'test permission'])->toArray();
$this->actingAs($this->admin)
->post(route('admin.access.permission.store'), $permission)
->assertRedirect(route('admin.access.permission.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.permissions.created')]);
$this->assertDatabaseHas(config('access.permissions_table'), [
'name' => $permission['name'],
]);
Event::assertDispatched(PermissionCreated::class);
}
/** @test */
public function it_fails_for_validation_on_update_permission()
{
$permission = create(Permission::class);
$data = $permission->toArray();
$data['name'] = '';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.access.permission.update', $permission), $data)
->assertSessionHasErrors(['name']);
}
/** @test */
public function a_user_can_update_permission()
{
Event::fake();
$permission = create(Permission::class);
$data = $permission->toArray();
$data['name'] = 'Updated Permission Name';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.access.permission.update', $permission), $data)
->assertRedirect(route('admin.access.permission.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.permissions.updated')]);
$this->assertDatabaseHas(config('access.permissions_table'), [
'name' => $data['name'],
]);
Event::assertDispatched(PermissionUpdated::class);
}
/** @test */
public function a_user_can_delete_a_permission()
{
Event::fake();
$permission = create(Permission::class);
$this->actingAs($this->admin)
->delete(route('admin.access.permission.destroy', $permission))
->assertStatus(302)
->assertSessionHas(['flash_success' => trans('alerts.backend.permissions.deleted')]);
/*$this->assertDatabaseMissing('permissions', [
'name' => $permission->name, 'id' => $permission->id
]);*/
Event::assertDispatched(PermissionDeleted::class);
}
}
<?php
namespace Tests\Feature\Backend;
use App\Events\Backend\Access\Role\RoleCreated;
use App\Events\Backend\Access\Role\RoleDeleted;
use App\Events\Backend\Access\Role\RoleUpdated;
use App\Exceptions\GeneralException;
use App\Models\Access\Permission\Permission;
use App\Models\Access\Role\Role;
use Illuminate\Support\Facades\Event;
use Tests\TestCase;
class ManageRolesTest extends TestCase
{
/** @test */
public function a_user_can_view_roles()
{
$this->actingAs($this->admin)
->get(route('admin.access.role.index'))
->assertViewIs('backend.access.roles.index')
->assertSee(trans('labels.backend.access.roles.management'))
->assertSee('Action');
}
/** @test */
public function a_role_requires_a_name()
{
$role = make(Role::class, ['name' => null])->toArray();
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.role.store'), $role)
->assertSessionHasErrors('name');
}
/** @test */
public function a_role_requires_a_permission_if_associated_permissions_is_not_set_to_all()
{
$role = make(Role::class)->toArray();
$role['associated_permissions'] = 'custom';
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.role.store'), $role)
->assertSessionHasErrors('permissions');
}
/** @test */
/*public function a_role_can_not_create_if_name_is_already_exists()
{
$role = make(Role::class, ['name' => $this->adminRole->name])->toArray();
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.role.store'), $role);
$this->assertSessionHas(['flash_danger' => trans('exceptions.backend.access.roles.already_exists')]);
$this->expectException(GeneralException::class);
}*/
/** @test */
public function a_user_can_create_new_role()
{
// Make sure our events are fired
Event::fake();
$role = make(Role::class, ['name' => 'test Role'])->toArray();
$role['associated_permissions'] = 'all';
$this->actingAs($this->admin)
->post(route('admin.access.role.store'), $role)
->assertRedirect(route('admin.access.role.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.roles.created')]);
$this->assertDatabaseHas(config('access.roles_table'), [
'name' => $role['name'],
]);
Event::assertDispatched(RoleCreated::class);
}
/** @test */
public function a_user_can_create_new_role_with_permissions()
{
// Make sure our events are fired
Event::fake();
$role = make(Role::class, ['name' => 'test Role'])->toArray();
$permission = create(Permission::class);
$role['associated_permissions'] = 'custom';
$role['permissions'] = [$permission->id];
$this->actingAs($this->admin)
->post(route('admin.access.role.store'), $role)
->assertRedirect(route('admin.access.role.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.roles.created')]);
$this->assertDatabaseHas(config('access.roles_table'), [
'name' => $role['name'],
]);
$this->assertDatabaseHas(config('access.permissions_table'), ['name' => $permission->name]);
$this->assertDatabaseHas(config('access.permission_role_table'), ['permission_id' => $permission->id]);
Event::assertDispatched(RoleCreated::class);
}
/** @test */
public function it_fails_for_validation_on_update_role()
{
$role = create(Role::class);
$data = $role->toArray();
$data['name'] = '';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.access.role.update', $role), $data)
->assertSessionHasErrors(['name']);
}
/** @test */
public function a_user_can_update_role()
{
Event::fake();
$role = create(Role::class);
$permission = create(Permission::class);
$data = $role->toArray();
$data['associated_permissions'] = 'custom';
$data['permissions'] = [$permission->id];
$data['name'] = 'Updated Role Name';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.access.role.update', $role), $data)
->assertRedirect(route('admin.access.role.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.roles.updated')]);
$this->assertDatabaseHas(config('access.roles_table'), [
'name' => $data['name'],
]);
$this->assertDatabaseHas(config('access.permissions_table'), ['name' => $permission->name]);
$this->assertDatabaseHas(config('access.permission_role_table'), ['permission_id' => $permission->id]);
Event::assertDispatched(RoleUpdated::class);
}
/** @test */
public function a_user_can_delete_a_role()
{
Event::fake();
$role = create(Role::class);
$this->actingAs($this->admin)
->delete(route('admin.access.role.destroy', $role))
->assertStatus(302)
->assertSessionHas(['flash_success' => trans('alerts.backend.roles.deleted')]);
/*$this->assertDatabaseMissing(config('access.roles_table'), [
'name' => $role->name,
'id' => $role->id
]);*/
Event::assertDispatched(RoleDeleted::class);
}
}
<?php
namespace Tests\Feature\Backend;
use App\Models\Settings\Setting;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class ManageSettingsTest extends TestCase
{
protected $setting;
public function setUp(): void
{
parent::setUp();
$this->setting = Setting::find(1);
$this->actingAs($this->admin);
}
/** @test */
public function setting_page_shows_different_tabs()
{
$this->get(route('admin.settings.edit', $this->setting))
->assertSee(__('labels.backend.settings.seo'))
->assertSee(__('labels.backend.settings.companydetails'))
->assertSee(__('labels.backend.settings.mail'))
->assertSee(__('labels.backend.settings.footer'))
->assertSee(__('labels.backend.settings.terms'))
->assertSee(__('labels.backend.settings.google'));
}
/** @test */
public function it_can_update_a_valid_site_logo()
{
$this->patch(route('admin.settings.update', $this->setting), [
'logo' => UploadedFile::fake()->image('logo.jpg', 226, 48),
]);
Storage::disk('public')->assertExists('img/logo/'.$this->setting->logo);
}
/** @test */
public function it_throws_error_for_valid_site_logo()
{
$this->withExceptionHandling();
$this->patch(route('admin.settings.update', $this->setting), [
'logo' => UploadedFile::fake()->image('logo.jpg', 200, 500),
])
->assertSessionHasErrors('logo');
}
/** @test */
public function it_can_update_site_favicon()
{
$this->patch(route('admin.settings.update', $this->setting), [
'favicon' => UploadedFile::fake()->image('favicon.jpg', 16, 16),
]);
Storage::disk('public')->assertExists('img/favicon/'.$this->setting->favicon);
}
/** @test */
public function it_throws_error_for_valid_site_favicon()
{
$this->withExceptionHandling();
$this->patch(route('admin.settings.update', $this->setting), [
'favicon' => UploadedFile::fake()->image('favicon.jpg', 200, 500),
])
->assertSessionHasErrors('favicon');
}
}
<?php
namespace Tests\Feature\Backend;
use App\Events\Backend\Access\User\UserCreated;
use App\Events\Backend\Access\User\UserDeactivated;
use App\Events\Backend\Access\User\UserDeleted;
use App\Events\Backend\Access\User\UserPermanentlyDeleted;
use App\Events\Backend\Access\User\UserReactivated;
use App\Events\Backend\Access\User\UserRestored;
use App\Events\Backend\Access\User\UserUpdated;
use App\Models\Access\Permission\Permission;
use App\Models\Access\Role\Role;
use App\Models\Access\User\User;
use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
use Carbon\Carbon;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
use Tests\TestCase;
class ManageUsersTest extends TestCase
{
/**
* Create User.
*
* @param $overrides
*
* @return [array] User array
*/
protected function createUser($overrides = [])
{
$user = factory(User::class, $overrides = [])->states('active', 'confirmed')->make()->toArray();
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.user.store'), $user);
}
/** @test */
public function a_user_can_view_active_users()
{
$this->actingAs($this->admin)
->get(route('admin.access.user.index'))
->assertViewIs('backend.access.users.index')
->assertSee(trans('labels.backend.access.users.management'))
->assertSee(trans('labels.backend.access.users.active'))
->assertSee('Action');
}
/** @test */
public function a_user_can_view_deactevated_users()
{
$this->actingAs($this->admin)
->get(route('admin.access.user.deactivated'))
->assertViewIs('backend.access.users.deactivated')
->assertSee(trans('labels.backend.access.users.management'))
->assertSee(trans('labels.backend.access.users.deactivated'))
->assertSee('Action');
}
/** @test */
public function a_user_can_view_deleted_users()
{
$this->actingAs($this->admin)
->get(route('admin.access.user.deleted'))
->assertViewIs('backend.access.users.deleted')
->assertSee(trans('labels.backend.access.users.management'))
->assertSee(trans('labels.backend.access.users.deleted'))
->assertSee('Action');
}
/** @test */
public function a_user_can_view_single_user()
{
$this->actingAs($this->admin)
->get('/admin/access/user/'.$this->admin->id)
->assertViewIs('backend.access.users.show')
->assertSee('View User')
->assertSee('Overview')
->assertSee('History')
->assertSee($this->admin->first_name)
->assertSee($this->admin->last_name)
->assertSee($this->admin->email);
}
/** @test */
public function a_user_requires_a_first_name()
{
$this->createUser(['first_name' => null])
->assertSessionHasErrors('first_name');
}
/** @test */
public function a_user_requires_a_last_name()
{
$this->createUser(['last_name' => null])
->assertSessionHasErrors('last_name');
}
/** @test */
public function a_user_requires_a_email()
{
$this->createUser(['email' => null])
->assertSessionHasErrors('email');
}
/** @test */
public function a_user_requires_a_password()
{
$this->createUser(['password' => null])
->assertSessionHasErrors('password');
}
/** @test */
public function a_user_requires_a_confirm_password()
{
$user = factory(User::class)->states('active', 'confirmed')->make()->toArray();
$user['password'] = 'Viral@1234';
$user['password_confirmation'] = 'Viral@1235';
$this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.user.store'), $user)
->assertSessionHasErrors('password');
}
/** @test */
public function a_user_requires_a_role()
{
$this->createUser()
->assertSessionHasErrors('assignees_roles');
}
/** @test */
public function a_user_requires_a_permission()
{
$this->createUser()
->assertSessionHasErrors('permissions');
}
/** @test */
public function create_user_fails_if_email_is_exists()
{
$this->createUser(['email' => 'admin@admin.com'])
->assertSessionHasErrors('email');
}
/** @test */
public function a_user_can_create_new_user()
{
// Make sure our events are fired
Event::fake();
$user = factory(User::class)->states('active', 'confirmed')->make()->toArray();
$role = create(Role::class);
$permission = create(Permission::class);
$user['password'] = 'Viral@1234';
$user['password_confirmation'] = 'Viral@1234';
$user['assignees_roles'] = [$role->id];
$user['permissions'] = [$permission->id];
$this->actingAs($this->admin)
->post(route('admin.access.user.store'), $user)
->assertRedirect(route('admin.access.user.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.users.created')]);
$this->assertDatabaseHas(config('access.users_table'), [
'first_name' => $user['first_name'],
'last_name' => $user['last_name'],
'email' => $user['email'],
'status' => 1,
'confirmed' => 1,
]);
$this->assertDatabaseHas(config('access.roles_table'), ['name' => $role->name]);
$this->assertDatabaseHas(config('access.permissions_table'), ['name' => $permission->name]);
$this->assertDatabaseHas(config('access.role_user_table'), ['role_id' => $role->id]);
Event::assertDispatched(UserCreated::class);
}
/** @test */
public function an_email_will_be_sent_to_uncomfirmed_user()
{
// Make sure our events are fired
Event::fake();
// Make sure our notifications are sent
Notification::fake();
$user = factory(User::class)->states('active')->make()->toArray();
$role = create(Role::class);
$permission = create(Permission::class);
$user['password'] = 'Viral@1234';
$user['password_confirmation'] = 'Viral@1234';
$user['confirmation_email'] = 1;
$user['assignees_roles'] = [$role->id];
$user['permissions'] = [$permission->id];
$this->actingAs($this->admin)
->post(route('admin.access.user.store'), $user)
->assertRedirect(route('admin.access.user.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.users.created')]);
$this->assertDatabaseHas(config('access.users_table'), [
'first_name' => $user['first_name'],
'last_name' => $user['last_name'],
'email' => $user['email'],
'status' => 1,
'confirmed' => 0,
]);
$this->assertDatabaseHas(config('access.roles_table'), ['name' => $role->name]);
$this->assertDatabaseHas(config('access.permissions_table'), ['name' => $permission->name]);
$this->assertDatabaseHas(config('access.role_user_table'), ['role_id' => $role->id]);
// Get the user that was inserted into the database
$insertedUser = User::where('email', $user['email'])->first();
// Check that the user was sent the confirmation email
Notification::assertSentTo([$insertedUser], UserNeedsConfirmation::class);
Event::assertDispatched(UserCreated::class);
}
/** @test */
public function it_fails_for_validation_on_update_user()
{
$user = create(User::class);
$user1 = $user->toArray();
$user1['first_name'] = '';
$user1['last_name'] = '';
$user1['email'] = '';
$user1['assignees_roles'] = '';
$user1['permissions'] = '';
$this->withExceptionHandling()
->actingAs($this->admin)
->patch(route('admin.access.user.update', $user), $user1)
->assertSessionHasErrors(['first_name', 'last_name', 'email', 'assignees_roles', 'permissions']);
}
/** @test */
public function a_user_can_update_new_user()
{
Event::fake();
$user = create(User::class);
$role = create(Role::class);
$permission = create(Permission::class);
$data = $user->toArray();
$data['first_name'] = 'updated first_name';
$data['last_name'] = 'updated last_name';
$data['assignees_roles'] = [$role->id];
$data['permissions'] = [$permission->id];
$this->actingAs($this->admin)
->patch(route('admin.access.user.update', $user), $data)
->assertRedirect(route('admin.access.user.index'))
->assertSessionHas(['flash_success' => trans('alerts.backend.users.updated')]);
$this->assertDatabaseHas(config('access.users_table'), [
'id' => $user->id,
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
]);
Event::assertDispatched(UserUpdated::class);
}
/** @test */
public function a_user_can_delete_a_user()
{
Event::fake();
$user = create(User::class);
$this->actingAs($this->admin)
->delete(route('admin.access.user.destroy', $user))
->assertStatus(302)
->assertSessionHas(['flash_success' => trans('alerts.backend.users.deleted')]);
$this->assertDatabaseMissing(config('access.users_table'), [
'name' => $user->first_name,
'id' => $user->id,
]);
Event::assertDispatched(UserDeleted::class);
}
/** @test */
public function a_user_can_not_delete_himself()
{
$this->withExceptionHandling()
->actingAs($this->admin)
->delete(route('admin.access.user.destroy', $this->admin))
->assertSessionHas(['flash_danger' => trans('exceptions.backend.access.users.cant_delete_self')]);
$this->assertDatabaseHas(config('access.users_table'), ['id' => $this->admin->id, 'deleted_at' => null]);
}
/** @test */
public function a_user_can_restore_a_deleted_user()
{
Event::fake();
$this->user->deleted_at = Carbon::now();
$this->user->save();
$this->actingAs($this->admin)
->get(route('admin.access.user.restore', $this->user))
->assertSessionHas(['flash_success' => trans('alerts.backend.users.restored')]);
Event::assertDispatched(UserRestored::class);
}
/** @test */
public function a_user_can_permanently_delete_user()
{
Event::fake();
$this->user->deleted_at = Carbon::now();
$this->user->save();
$this->actingAs($this->admin)
->get(route('admin.access.user.delete-permanently', $this->user))
->assertSessionHas(['flash_success' => trans('alerts.backend.users.deleted_permanently')]);
Event::assertDispatched(UserPermanentlyDeleted::class);
}
/** @test */
public function a_user_can_mark_user_as_inactive_and_active()
{
Event::fake();
$this->actingAs($this->admin)
->get(route('admin.access.user.mark', [$this->user, 0]))
->assertSessionHas(['flash_success' => trans('alerts.backend.users.updated')]);
$this->assertDatabaseHas(config('access.users_table'), ['id' => $this->user->id, 'status' => 0]);
$this->actingAs($this->admin)
->get(route('admin.access.user.mark', [$this->user, 1]))
->assertSessionHas(['flash_success' => trans('alerts.backend.users.updated')]);
$this->assertDatabaseHas(config('access.users_table'), ['id' => $this->user->id, 'status' => 1]);
Event::assertDispatched(UserDeactivated::class);
Event::assertDispatched(UserReactivated::class);
}
}
<?php
namespace Tests\Feature\Frontend;
use App\Events\Frontend\Auth\UserLoggedOut;
use Illuminate\Support\Facades\Event;
use Tests\BrowserKitTestCase;
/**
* Class LoggedInRouteTest.
*/
class LoggedInRouteTest extends BrowserKitTestCase
{
/**
* Test the homepage works and the dashboard button appears.
*/
public function testHomePageLoggedIn()
{
$this->actingAs($this->user)->visit('/')->see('Dashboard')->see($this->user->name)->dontSee('Administration');
}
/**
* Test the dashboard page works and displays the users information.
*/
/** @test */
public function dashboard_page_loads_properly()
{
$this->actingAs($this->user)
->visit('/dashboard')
->see($this->user->email)
->see('Joined')
->dontSee('Administration');
}
/**
* Test the account page works and displays the users information.
*/
/** @test */
public function account_page_loads_properly()
{
$this->actingAs($this->user)
->visit('/account')
->see('My Account')
->see('Profile')
->see('Update Information')
->see('Change Password')
->dontSee('Administration');
}
/** @test */
public function users_can_logout()
{
// Make sure our events are fired
Event::fake();
$this->actingAs($this->user)->visit('/logout')->see('Login')->see('Register');
Event::assertDispatched(UserLoggedOut::class);
}
}
<?php
namespace Tests\Feature\Frontend;
use App\Events\Frontend\Auth\UserConfirmed;
use App\Models\Access\User\User;
use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
use Tests\BrowserKitTestCase;
/**
* Class LoggedOutRouteTest.
*/
class LoggedOutRouteTest extends BrowserKitTestCase
{
/**
* User Logged Out Frontend.
*/
/** @test */
public function test_homePage()
{
$this->visit('/')->assertResponseOk();
}
/** @test */
public function testLoginPage()
{
$this->visit('/login')->see('Login');
}
/** @test */
public function testRegisterPage()
{
$this->visit('/register')->see('Register');
}
/** @test */
public function testForgotPasswordPage()
{
$this->visit('password/reset')->see('Reset Password');
}
/** @test */
public function testDashboardPageLoggedOut()
{
$this->visit('/dashboard')->seePageIs('/login');
}
/** @test */
public function testAccountPageLoggedOut()
{
$this->visit('/account')->seePageIs('/login');
}
/**
* Create an unconfirmed user and assure the user gets
* confirmed when hitting the confirmation route.
*/
/** @test */
public function confirm_account_route()
{
Event::fake();
// Create default user to test with
$unconfirmed = factory(User::class)->states('unconfirmed')->create();
$unconfirmed->attachRole(3); //User
$this->visit('/account/confirm/'.$unconfirmed->confirmation_code)
->seePageIs('/login')
->see('Your account has been successfully confirmed!')
->seeInDatabase(config('access.users_table'), ['email' => $unconfirmed->email, 'confirmed' => 1]);
Event::assertDispatched(UserConfirmed::class);
}
/**
* Assure the user gets resent a confirmation email
* after hitting the resend confirmation route.
*/
/** @test */
public function resend_confirm_account_route()
{
Notification::fake();
$this->visit('/account/confirm/resend/'.$this->user->id)
->seePageIs('/login')
->see('A new confirmation e-mail has been sent to the address on file.');
Notification::assertSentTo(
[$this->user],
UserNeedsConfirmation::class
);
}
/** @test */
public function test_404Page()
{
$response = $this->call('GET', '7g48hwbfw9eufj');
$this->assertEquals(404, $response->getStatusCode());
$this->assertContains('Page Not Found', $response->getContent());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment