clemblanco clemblanco
5

Testing Model Observer Events - Laravel 5.6

I'm facing a weird issue today while trying to test a Model Observer Event. App\Providers\AppServiceProvider public...
suomato suomato
3

Testing Custom Artisan Command

Hello, I am working on a new Artisan command which help me(or you) to generate a new Vue component with boilerplate. Now the command works well and I would like to m...
Testing
3
145
AlexGodbehere AlexGodbehere
4

Database does not exist when trying to use MySQL for PHPUnit tests

I have a MySQL database on my local machine that I use for development. Up to now, I've been using sqlite in-memory databases for my testing, but I want to test my suite ag...
Ashraam Ashraam
1

Testing file upload and resizing won't work

Hi everyone, I'm learning to develop using the TDD way and I'm facing this problem I can't solve. I'm uploading an image which is resized and store in databas...
matalina matalina
2

assertStatus giving errors

New to testing. But not exactly sure why I'm getting this error on the frist run, and then it passes on the other two (at least that's what I'm assuming) I have thr...
danielcoker danielcoker
4

Disable Exception Handling In Laravel Tests

I've been trying to disable exception handling in my test so I can see the errors, but it's not working even if I intentionally break the code. I'm just getting this...
Testing
4
137
DawgOnKing DawgOnKing
7

phpunit :: Laravel redirect upon validation failure

Please consider the following: //controller public function store() { $attributes = request()->validate([ 'name' => 'required',...
bwrigley bwrigley
4

How to test mail sent from Notification

My users can specify if they have Notifications sent to them instantly or to be notified daily of any pending Notifications. This all works fine with manual testing,...
nexxai nexxai
7

Unknown database ':memory:'

Am I missing something here? I've got my phpunit.xml set up correctly (I think): <env name="APP_ENV" value="testing"/> <env nam...
Testing
7
203
webcodecs webcodecs
4

Using factory in PHPUnit provider fails

Hey guys, i try to use a factory to makeusers in a provider. If i use the factory in the test directly, there was no problem. If i try to use it in a testing p...
Testing
4
223
bwrigley bwrigley
8

Testing Notifications

I have set up my project so that a user can specify if they would like their notifications instantly, daily, weekly and via sms, email, or just in their dashboard. S...
DawgOnKing DawgOnKing
2

Assert Value is equal to Array Value

Given the following: $array = ['ONE', 'TWO', 'THREE']; $value = 'TWO' How do I assert the following: $this->assertEquals($...
lyleyboy lyleyboy
5

Dusk testing a < select > field just doesn't work

Hi folks, I'm hoping this is pretty straight forward but I'm using Dusk to test creating a new user (there are a few extra fields compared to the standard) On...
Jamesst20 Jamesst20
1

Kahlan v4 setup for Laravel 5.8

Hi, I would love to test my current application with the Kahlan testing framework :...
xtremer360 xtremer360
1

Assertions with Datetime of MorphByMany Relationships

Hi all. I'm trying to figure out what my assertion would look like for test below. Currently, my Stable factory when created will create a default wrestler for its g...
amidknight amidknight
1

Laravel Dusk Test Cases in Different Sub-Dir than Browser

Does this just fall under the "you're doing it wrong" category? I'm trying to setup browser testing and would like to put the test classes into a different...
Continuum Continuum
1

Basic Authentication with Dusk

I'd like to run Dusk tests on a remote site that is behind basic auth (.htaccess) - The browser will pop-up a browser-level dialog that asks for the authentication details....
JorickL JorickL
7

Swap class when running test?

In my Laravel 5.7 I want to 'fake' an API endpoint of a service we use. I've created a 'Fake class' which acts as the API. In my models I whip up a new connection to the ex...

Post vs. Post Json

Hey this threw for for a crazy loop, so I thought I'd point it out here and maybe get some guidance. I was writing up a test for my endpoint 'client.store', and in m...
ShaneTurner ShaneTurner
11

phpunit.xml not being read, using variables from .env

I can't get tests to run from a testing environment, they always seem to run using the 'local' variables set in the .env file rather than the settings in phpunit.xml...
Testing
11
429

Model Events not trigerring when using factories

Hello all! I'm facing an issue... I don't know why but my model events does not fire when I use factories... I have this boot: class App\MyModel exten...
phpMick phpMick
6

Testing that the log record has been written.

Hi, How can I test that a record has been written to my log file? I am just using the standard Laravel logging? Cheers, Mick...
matttonks11 matttonks11
1

Trying to get property of non-object auth()->user()->subjects()

Hi there, I'm currently trying to test some middleware I created for my application. However i'm currently getting the error message... ErrorException:...
kennybjr87 kennybjr87
10

RuntimeException: No application encryption key has been specified 5.8

I downloaded a brand new install of laravel 5.8 before even doing any coding at all running phpunit on the ExampleTest is failing with a RuntimeException: No application en...
Testing
10
130
bwrigley bwrigley
1

Starting ChromeDriver manually

I'm writing a little artisan command line tool that I need to browse my site with javascript execution. Initially I was calling: \Laravel\Dusk\TestCas...
phikhi phikhi
0

Testing DB join queries over connections with SQLite :memory: databases

In my application I have this query which uses joins over a different mysql connection. DB::connection('tenant1')->table('stats AS t'...
hippo hippo
2

PHPUnit issues on example Feature Test

/** @test */ public function anyone_can_see_our_home_page() { //wtf $response = $this->get('/'); $response->assertStatus(2...
DNABeast DNABeast
2

Unable to build a Markdown mail from a test environment

I've made a new project. Created a Mailable with a markdown template. I can send the mail from a route. Route::get('/demo', function () { \Mail::to('[email protected]...
ludo237 ludo237
1

Testing events with PHPSpec

Hello everyone. I'm building a test suite and I'm testing my command RegisterUser that has a method handle() like this...
ludo237 ludo237
3

Middleware Throwing Exception when testing controllers

Hello everyone. I'm trying to test an AuthController, in particular the registration method which is linked to a view that has a reCaptcha on it. At the momen...
ludo237 ludo237
5

Calling PHPUnit from Artisan command will ignore the XML File

Greetings everyone. I have what I think is an uncommon issue but I'll try to explain as clear as I can. I have created a simple artisan command that does this...
Testing
5
122
ludo237 ludo237
4

Help figuring out how to test on demand notification

Hello Everyone. I have a slack notification class that sends a message inside our company slack, in a specific channel, every time an user performs the activation pr...
Testing
4
207
datamonster datamonster
3

Laravel Dusk Testing - Old template files are shown

Hi, I've customized registration process and now testing via Laravel dusk. It was working fine then suddenly my tests are failing and when i noticed the screenshots...
barrymcm barrymcm
8

How do I mock this app()->getLocale()

I need to mock app()->getLocale() but I don't know how to mock the app() helper. Ive tried to mock Application but thats not working as I get the following error: Reflec...
finchy70 finchy70
3

phpunit not using phpunit.xml settings

My phpunit.xml <?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes=&...
Create a New Discussion Button