PHP code example of azenox / php-string2chaining

1. Go to this page and download the library: Download azenox/php-string2chaining 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/ */

    

azenox / php-string2chaining example snippets


public function setUp(): void
{
    parent::setUp();

    $this->user1 = User::find(1);
    $this->user2 = User::find(2);
}

private function userPayload()
{
    return [
        'test with user1' => [
            'user1',
            'birth_date->format(\'Y-m-d\')',
            '1998-08-22'
        ],
        'test with user2' => [
            'user2',
            'another_date->format(\'Y-m-d\')',
            '1998-03-30'
        ],
    ];
}

/**
 * @test
 * @dataProvider userPayload
 */
public function birth_date_should_be_equals_to_this_date($user, $str, $test)
{
    $obj = $this->{$user};

    $this->assertEquals($test, String2chaining::parse($obj, $str));
}
bash
composer