Maged Maged
7
when i run phpunit i get this error Illuminate\Database\QueryException: could not find driver (SQL: PRAGMA foreign_keys = ON;) i'm working on ubuntu any idea ?...
santino replied
Solved
Nimrod Nimrod
0
Hi. Following problem I can't get my head around: ... $this->get('https://laravel.com')->assertOk(); // OK $this->get('https://laravel.com/img/logotype.min.svg')->assertOk(); // 404 ... I just want to test, that my uploaded images are ac...
gianmarx gianmarx
1
when i launch this test: function test_completing_a_new_task_records_projects_activity() { $project = ProjectFactory::withTask(1)->create(); $project->addTask('Some task'); $this->patch($project->task[0]->path(),[...
untymage untymage
1
I want to test laravel Cache facade but when i mock it says: Mockery\Exception\BadMethodCallException : Method Mockery_0_Illuminate_Cache_CacheManager::remember() does not exist on this mock object /** @test */ public function it_should_cache_the_d...
bugsysha replied
Solved
steveb steveb
1
Hi Laravel-fam, I'm using https://github.com/aloha/laravel-twilio to send SMS notifications in my app. I've written tests for all of my code but I don't actually want to send SMS messages during testing. The repo says: There is a dummy implementation...
rudexpunx rudexpunx
15
From the doc.: ###Resetting The Database After Each Test It is often useful to reset your database after each test so that data from a previous test does not interfere with subsequent tests. The RefreshDatabase trait takes the most optimal approach t...
naing naing
5
I am trying to assert the text in a button with Dusk selector as mentioned in https://laravel.com/docs/5.6/dusk#dusk-selectors. HTML <button dusk='login-button' type="submit" class="btn btn-primary"> {{ __('Login') }}...
nicolaferrara82 nicolaferrara82
4
This is a basic Unit test, the question is how $this->property is set to be available in testBasicTest(). There are no magic methods __set() and __get() in PHPUnit\Framework\TestCase and in PHPUnit\Framework\Assert extended class but still the pr...
rchaffer rchaffer
1
So I'm developing a package that assembles admin views dynamically from schema, where:- The consumer creates a subclass of a package class (in which they tell it which columns to render in lists/forms) In a controller action, the consumer returns...
trevorpan trevorpan
3
https://laracasts.com/discuss/channels/testing/php-unit-risky-test-whats-the-cause-of-it-and-how-to-avoid Have an unusual error here. It seems to be related to a brew update, but I'm not certain. At any rate I went through the blade views on the risk...
untymage untymage
3
In my app i use php://input to get data from web hook like this: $data= json_decode(file_get_contents('php://input'), true); So how can simulate this when i unit testing ?...
laracastsluvr laracastsluvr
8
Hello, I've started implementing tests into an existing L8.x project and noticed that I can't get it to throw the MassAssignmentException when I forget to include a column in a model's fillable guard. I'm just getting an "Integrity constraint vi...
nbbfv nbbfv
5
Hi, I have a very simple test case: $this->visitRoute('players.financials', $player) // He should receive HTTP 200 ->assertResponseStatus(200); I always get this message: There was 1 risky test: Test code or tested code did no...
bluetitanboy bluetitanboy
0
Dusk Version: 6.4 Laravel Version: 6.2 PHP Version: 7.3 Database Driver & Version: mysql Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL) Description: Tests are now failing when searching for text on a raw column that has <...
gianmarx gianmarx
3
I'm at this lesson https://laracasts.com/series/build-a-laravel-app-with-tdd/episodes/16 minute 11:00 when i launch this test i get a different error than the course one public function test_a_user_can_update_a_project() { $this->signIn();...
gianmarx gianmarx
3
I'm at this lesson https://laracasts.com/series/build-a-laravel-app-with-tdd/episodes/14 minute 18:16 when i launch this test i get a different error than the course one public function test_a_user_can_create_a_project() { $this->w...
Tray2 replied
Solved
Synchro Synchro
3
I've seen lots of discussion about how to deal with fixed data needed by apps, and whether to create it in seeders or migrations, or to call seeders from migrations, etc. The general separation also applies to testing, where the consensus seems to be...
gianmarx gianmarx
1
I'm at this lesson https://laracasts.com/series/build-a-laravel-app-with-tdd/episodes/14 minute 14:53 when i launch this test i get a different error than the course one use App\Models\Task; use Illuminate\Foundation\Testing\RefreshDatabase; use...
gianmarx gianmarx
1
I'm at this lesson https://laracasts.com/series/build-a-laravel-app-with-tdd/episodes/14 minute 09:27 I wrote this feature test in ProjectTasksTest.php: public function test_a_task_can_be_updated() { $this->withoutExceptionHandling(); $t...
gianmarx gianmarx
1
I'm doing the exercise: (https://laracasts.com/series/build-a-laravel-app-with-tdd/episodes/12) minute 07:00 I wrote this test in TestCase: abstract class TestCase extends BaseTestCase { use CreatesApplication; protected function singIn(...
gianmarx gianmarx
1
related to lesson 06 of Build A Laravel App With TDD . when i go to the one page show i get the following error: Call to undefined method Illuminate\Database\Eloquent\Relations\BelongsTo::getKey() in the Project model I wrote the following method: p...
longestdrive longestdrive
2
Hi I've just started looking at using cypress to test my front end and whilst I get most of it I'm trying to get my head around the best approaches to handle access to the secure pages of the site where a user needs to be logged in. I've pulled in la...
gianmarx gianmarx
6
I wrote this test related to lesson 06 of Build A Laravel App With TDD minute 05:52 public function test_a_user_can_view_their_project() { $this->be(User::factory()->create()); $this->withoutExceptionHandling(); $project = Proje...
gianmarx gianmarx
4
I'm doing the exercise from lesson 05 :A Project Requires An Owner minute 09:47 I wrote this unit test for User: namespace Tests\Unit; use http\Client\Curl\User; use PHPUnit\Framework\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; use...
oroalej oroalej
1
Hi, Can someone explain to me what's happening. I have this setUp configuration. public $user; public function setUp(): void { parent::setUp(); $this->user = User::factory()->create(); } and test case public function test_can_create_catego...
bellini bellini
1
Hey I am trying to create a test of when I click on the first resource row shown on the current page. For example If I wanted to navigate to the row with id of 1 I would do: $this->browse(function (Browser $browser) { $browser-...
gianmarx gianmarx
4
I wanted to test this method with a feature test: public function getTask(Request $requestSvr) { $requestSvr->all(); $requestSvr['id_server'] = (string) $requestSvr['id_server']; $task = Task::whereIn('works', $request...
untymage untymage
1
Excuse me i want to why shouldReceive() always return true even i dont have the method ? MyFacade::shouldReceive('IdontHaveThisMethod') // return true It only works when i do: MyFacade::shouldReceive('IdontHaveThisMethod')->once()...
goaround goaround
5
Hi, I try to write some test to check if my Jetstream Team Permissions works as expected. Therefore, I first check if I get a forbidden if my Team role is not sufficient. Then I change the membership role right in the database: $membership = Membersh...
forrestedw forrestedw
0
I have a Livewire component called Basket that has another Livewire component nested in a loop like this: @foreach($basket->itemsGroupedByShop() as $basketItems) ... <livewire:basket-item-quantity :basketItem="$basketItem"/>...
Bom_Basti Bom_Basti
4
Hi, I want to test the "to", "from" and "subject" of an Mailable in Laravel 5.5. If I write my test like this, everything is working fine, if the "to" address matches. Mail::assertSent(NewOffer::class, function...
fakeheal fakeheal
3
I have an email I send when people sign up. Texts in .blade.php file are formatted by my IDE. How can I test those texts reliably? I am using Mailthief as the version of Laravel is 5.2. Test: $texts = [ "Welcome", "Proin aliqua...
pookerbutt pookerbutt
0
I'm just starting to learn Jest and I'm having some issues getting started. Basically I'm trying to test a function that fetches data when the component mounts. From my understanding the best option is to make a mock version of the axios request. So...
fredmoras fredmoras
4
Hi, I am newby with unit test and i wanna try a method who forceDelete a model if it's possible else use the soft delete if this model has any relation. the code work well, but the softdelete test always fail if i call a ModelDeleteManager, it work...
pookerbutt pookerbutt
0
Hello Everyone, I'm trying to add jest to my laravel/vue project and I'm having some issues when trying to test my custom components. For the most part, I think I got jest installed correctly (Because I was able to run a test on an example component...
Create a New Discussion Button