PHP code example of cruciblephp / crucible

1. Go to this page and download the library: Download cruciblephp/crucible library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cruciblephp / crucible example snippets


// PHPUnit — your existing suite, unchanged.
final class CalculatorTest extends TestCase
{
    public function testAddsTwoNumbers(): void
    {
        $this->assertSame(4, 2 + 2);
    }
}

// Pest — *.pest.php, natively.
it('rounds up', fn() => expect((int) ceil(1.2))->toBe(2));

// Architecture is a test, not a linter.
arch('the domain stays pure')->expect('App\Domain')->toOnlyUse('App\Domain');

// The browser is a first-class tier: the server runs inside the test
// process, so whatever the test faked is what the page sees.
visit('/checkout')->click('Place order')->waitForNetworkIdle()->assertSee('Thank you');

expect($x)->toBeString();          // $x itself is a string now, not only the chain
expect($user)->toMatchShape('array{id: positive-int, tags: list<string>}');
                                   // checked when the test runs, narrowed for PHPStan