PHP code example of viraj / cakephp-integrated

1. Go to this page and download the library: Download viraj/cakephp-integrated 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/ */

    

viraj / cakephp-integrated example snippets


protected $baseUrl = 'http://your-dev-url';

class DemoTest extends CakeTestCase
{
}

class DemoTest extends LegacyTestCase
{
}

class DemoTest extends CakeTestCase
{
    use DatabaseMigrations;
    
    protected $baseUrl = "http://local.yourapp.dev";

    /** @test */
    public function unauthenticated_user_cannot_see_the_add_posts_page()
    {
        $this->openPage('/posts/add')
             ->canSeePageUrlContains('/users/login');
    }

    /** @test */
    public function authenticated_user_can_add_a_new_post()
    {
        $user = factory('Users')->create();

        $this->actingAs($user)
             ->openPage('/posts/add')
             ->fillInField('title', 'My first post')
             ->fillInField('author', 'Viraj Khatavkar')
             ->fillInField('body', 'My Post body')
             ->check('published')
             ->press('Submit')
             ->canSeePageIs('/posts')
             ->seeText('My first post');
    }
}

$this->fillInField('name', 'Viraj Khatavkar');

$this->check('agree_to_terms');

$this->uncheck('agree_to_terms');

//Dropdown
$this->select('state', 'Pennsylvania');

//Radio
$this->select('gender', 'M');

//Text of the button
$this->press('Submit');


//Name of the button
$this->press('submit');

$this->canSeePageIs('/posts');

$this->canSeePageUrlContains('/po');


$user = factory('Users')->create();

$this->actingAs($user)->openPage('/posts/add');