Skip to content
Code and Bytes Code and Bytes

Code and Bytes
Code and Bytes

bitbucket-error-pipeline-phpunit

Solución: Error en Bitbucket Pipelines al ejecutar pruebas de Laravel con PHPUnit y Paratest

Posted on 27 September, 202412 October, 2024

Al ejecutar en el pipeline los tests unitarios aparece un error de memoria

In WorkerCrashedException.php line 41:
                                                                               
  The test "PARATEST='1' TEST_TOKEN='7' UNIQUE_TEST_TOKEN='7_66f1d266ad6eb' t  
  ests/Feature/PruebasTest.php" failed.                               
                                                                               
  Exit Code: 255(Unknown error)                                                
                                                                               
  Working directory: /opt/atlassian/pipelines/agent/build                      
                                                                               
  Output:                                                                      
  ================                                                             
                                                                               
  Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to all  
  ocate 16777248 bytes) in /opt/atlassian/pipelines/agent/build/vendor/maennc  
  hen/zipstream-php/src/File.php on line 332         

La solución es agregar un elemento <ini> al archivo de configuración de PHPUnit phpunit.xml con el valor memory_limit para aumentar la asignación de memoria, en mi caso lo aumenté a 512M

<php>
    <ini name="memory_limit" value="512M" />
</php>

Dando como resultado el archivo:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory>tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory>tests/Feature</directory>
        </testsuite>
    </testsuites>
    <source>
        <include>
            <directory>app</directory>
        </include>
    </source>
    <php>
        <ini name="memory_limit" value="512M" />
        <env name="APP_ENV" value="testing"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="DB_CONNECTION" value="sqlite"/>
        <env name="DB_DATABASE" value=":memory:"/>
        <env name="MAIL_MAILER" value="array"/>
        <env name="PULSE_ENABLED" value="false"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="TELESCOPE_ENABLED" value="false"/>
    </php>
</phpunit>
Laravel

Post navigation

Previous post
Next post

Related Posts

Laravel

Solución: Unable to create PsySH runtime directory. Make sure PHP is able to write to /run/user/1003 in order to continue.

Posted on 2 November, 202411 April, 2026

Cuando trabajamos con Laravel, php artisan tinker es una herramienta fundamental para interactuar rápidamente con nuestras aplicaciones desde la línea de comandos. Sin embargo, a veces al ejecutar este comando podemos encontrarnos con errores inesperados. Uno de ellos es el siguiente:

Read More
Laravel

Cómo mostrar alertas en Laravel con SweetAlert2 y validaciones personalizadas

Posted on 17 October, 202411 April, 2026

En esta entrada te mostraré cómo integrar SweetAlert2 en Laravel para mostrar alertas interactivas al eliminar registros. Además, implementaremos validaciones que verifican si hay dependencias antes de eliminar, asegurando que el proceso sea seguro y controlado. Con un ejemplo práctico, veremos cómo SweetAlert2 mejora la experiencia de usuario al mostrar…

Read More
Laravel

Google reCAPTCHA v2 en Laravel 12 con Livewire 3

Posted on 6 August, 202513 August, 2025

En este tutorial detallado, aprenderás a integrar Google reCAPTCHA v2 en tu aplicación Laravel 12 utilizando Livewire 3. Esta implementación ayudará a proteger tus formularios contra bots y spam, mejorando la seguridad de tu aplicación.

Read More

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Buscar

Categorias

  • AI (2)
  • Asterisk (9)
  • Bases de datos (1)
  • DevOps (4)
  • Git (2)
  • HTML (1)
  • Laravel (6)
  • Linux (67)
  • MCP Server (1)
  • Mikrotik (3)
  • MySQL (5)
  • n8n (1)
  • Personal (4)
  • PHP (15)
  • Python (2)
  • Software recomendado (1)
  • Tips (1)
  • VSCode (4)
  • vTiger (4)
  • Windows (10)
  • Wordpress (4)
©2026 Code and Bytes | WordPress Theme by SuperbThemes