• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups

Running tests using Pest

Bug Report
2
4
352
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    MartintheMartian last edited by 22 Aug 2024, 14:29

    Hi, we are trying to run the test suites using Pest in a local Sail environment and they all fail.

    Are we missing something?

    we are using the command sail artisan test (--env=testing).

    1 Reply Last reply Reply Quote 0
    • Rishabh-Webkul
      Rishabh-Webkul last edited by 23 Aug 2024, 09:31

      Hello @MartintheMartian

      Currently, we don't support Sail Although, this issue has already been raised and is open.

      Link - https://github.com/bagisto/bagisto/issues/9962

      In the future, we will provide this functionality.

      Thanks & Regards

      1 Reply Last reply Reply Quote 0
      • M
        MartintheMartian last edited by 27 Aug 2024, 14:40

        Okay I got the tests working locally with Sail.

        But now the nearly all the tests fail with a 401 instead of a 200 response in the Bitbucket pipeline, using this setup:

        image: php:8.3
        
        definitions:
          services:
            mysql:
              image: mysql:8.0
              environment:
                MYSQL_ROOT_PASSWORD: root
                MYSQL_DATABASE: bagisto
                MYSQL_USER: bagisto
                MYSQL_PASSWORD: password
        
        pipelines:
          default:
            - step:
                name: Install Dependencies
                caches:
                  - composer
                services:
                  - mysql
                script:
                  - apt-get update && apt-get install -y unzip libzip-dev git libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev
                  - docker-php-ext-configure gd --with-freetype --with-jpeg
                  - docker-php-ext-install gd exif intl calendar zip pdo pdo_mysql
                  - curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
                  - composer install --no-interaction --prefer-dist --optimize-autoloader --dev
                  - ls -al ./vendor/bin # List files in vendor/bin to confirm installation
                  - cp .env.example .env
                  - php artisan key:generate
        
            - step:
                name: Run Tests
                caches:
                  - composer
                services:
                  - mysql
                script:
                  - apt-get update && apt-get install -y unzip libzip-dev git libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev
                  - docker-php-ext-configure gd --with-freetype --with-jpeg
                  - docker-php-ext-install gd exif intl calendar zip pdo pdo_mysql
                  - curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
                  - composer install --no-interaction --prefer-dist --optimize-autoloader
                  - cp .env.example .env
                  - php artisan key:generate
                  - php artisan migrate
                  - php artisan serve &
                  - sleep 5
                  - php -d memory_limit=-1 artisan test
        
            - step:
                name: Build Artifacts
                script:
                  - php artisan config:cache
                  - php artisan route:cache
                artifacts:
                  - storage/logs
        
        
        1 Reply Last reply Reply Quote 0
        • 9 days later
        • Rishabh-Webkul
          Rishabh-Webkul last edited by 5 Sept 2024, 06:55

          Hello @MartintheMartian

          This issue is coming might be you are not getting the logged-in user that's why 401 error is coming.

          Kindly recheck it and let us know.

          Thanks & Regards

          1 Reply Last reply Reply Quote 0
          1 out of 4
          • First post
            1/4
            Last post