Questions tagged [pest]

Pest.rs is a parser in Rust that accepts PEG grammars

You can find more information on Pest.rs on their website.

50 questions
0
votes
1 answer

Create upload file test with Laravel Excel

I use Spatie Laravel Data and maatwebsite Laravel Excel. My test need use specific xlsx file stored inside my tests folder. I've seen a lot of test used fake files but I can't use one because it's special template. I try to create test to upload…
WantyJF
  • 29
  • 4
0
votes
1 answer

How to use .env.testing file in pest / phpunit and package development?

I am using Spatie Package Skelton to develop a package. It is using pest under the hood. I created a .env.testing file and checked the environment used while running a pest test with dd(app()->environment));, which is testing. Anyhow, when I use…
JanBoehmer
  • 395
  • 3
  • 14
0
votes
0 answers

How do I setup Mockery to return values based on previous method calls?

I'm using Laravel, Pest for my tests and Mockery for mocking. I have a simple action that looks like so: public function handle(): array { $sites = []; $envDir = dirname(__FILE__, 3).'/env'; $envFiles = File::glob($envDir.'/.env.*'); …
LeonardChallis
  • 7,759
  • 6
  • 45
  • 76
0
votes
0 answers

What's the correct way to use PEST in a Laravel application that uses Roles and Permissions?

I am very new to testing with PEST and I want to create tests, that required to create a new Client from a factory. The Client must have a permission for what I am using Spatie Permissions. The issue I have is that have the roles and permissions…
JanBoehmer
  • 395
  • 3
  • 14
0
votes
0 answers

Testing eloquent model events

I'm currently using a package that logs activity via listening for model events based on changes made to them (create/update/delete). The code functions as expected locally though when it comes to writing feature tests, logging deletions fails.…
delves
  • 13
  • 3
0
votes
0 answers

Parsing logical expressions with precedence using pest parser

I'm writing a grammar parser for my config evaluation library using pest parser. The grammar supports and, or, matches, == operators to create complex queries. For e.g. Input: "foo: when bar == 'apple' and baz matches 'foobaz'" Precedence of "==",…
h1990
  • 125
  • 3
  • 11
0
votes
1 answer

PEG error "expression cannot fail; following choices cannot be reached"

I tried to group together two cases to reduce code duplication in the grammar: From string = _{("'" ~ (string_value) ~ "'") | ("\"" ~ (string_value) ~ "\"") | ("\"" ~ (string_value_escape_1) ~ "\"") | ("'" ~ (string_value_escape_2) ~ "'")} …
Guy Korland
  • 9,139
  • 14
  • 59
  • 106
0
votes
1 answer

How to not progress in Rust pest parser

I am trying to build a basic Latex parser using pest library. For the moment, I only care about lines, bold format and plain text. I am struggling with the latter. To simplify the problem, I assume that it cannot contain these two chars: \, }. lines…
Ito Pakito
  • 110
  • 2
  • 9
0
votes
1 answer

Is there a way to prevent redirects when running PHP laravel test suite?

I am attempting to add Pest and unit tests to a Nova Admin/Laravel application. I want to test that a page exists, but I don't want to have to deal with whether or not the user is authenticated as an admin to view the page. I am trying to test that…
Asa LeHolland
  • 372
  • 4
  • 12
0
votes
0 answers

Laravel test failing when looking for data at view table

I'm writing an integration/feature test in Laravel 9 (using Pest) in which I create an Address that's associated to an existing customer. My customers' data live under a view that is created via migration: return new class extends Migration { …
MrCujo
  • 1,218
  • 3
  • 31
  • 56
0
votes
0 answers

Server not running when executing Laravel Orchestra Dusk Test

I am wanting to execute a simple test using Pest and using Orcestra Testbench Dusk. However when this happens, I encounter the following in the browser: This page isn’t working 127.0.0.1 is currently unable to handle this request. HTTP ERROR…
Zakalwe
  • 1,444
  • 3
  • 14
  • 25
0
votes
0 answers

Laravel config() function not working properly during tests

I have an application using laravel 8 that runs on laravel sail. When I launch the tests with the command sail artisan test I noticed something strange. The config() function of laravel was getting the wrong value, meanwhile, the env() function…
C. Celora
  • 429
  • 1
  • 3
  • 12
0
votes
1 answer

Rust pest parser fail

I'm learning pest parser written in Rust and I need to parse a file: {ISomething as Something, IOther as Other} I wrote a rule: LBrace = { "{" } RBrace = { "}" } Comma = { "," } As = { "as" } symbolAliases = { LBrace ~ importAliases ~ ( Comma ~…
PFA hard
  • 81
  • 5
0
votes
2 answers

Building a Solidity parser in Rust, hitting an `expression can not fail` and `recursion` error

I am building a Solidity parser with Rust. I am using the Pest Parser crate and am setting up my grammar.pest file to be very similar to the Solidity repo's Lexer/Parser. I am hitting two errors. The first is an error saying: | …
0xKitsune
  • 131
  • 6
0
votes
1 answer

PEG Grammar Parsing, error when expression starts with negative number

I have the following PEG grammar defined: Program = _{ SOI ~ Expr ~ EOF } Expr = { UnaryExpr | BinaryExpr } Term = _{Int | "(" ~ Expr ~ ")" } UnaryExpr = { Operator ~ Term } BinaryExpr = { Term ~ (Operator ~ Term)* } Operator = { "+" | "-" |…
Apollo
  • 945
  • 2
  • 9
  • 24