<?php


namespace calderawp\calderaforms\Tests\Integration\Features;


use calderawp\calderaforms\cf2\Factories\ProcessorFactory;
use calderawp\calderaforms\cf2\Forms\FormCollection;
use calderawp\calderaforms\cf2\Jobs\Scheduler;
use calderawp\calderaforms\cf2\Services\FormsService;
use calderawp\calderaforms\cf2\Services\ProcessorService;
use calderawp\calderaforms\cf2\Services\QueueSchedulerService;
use calderawp\calderaforms\cf2\Services\QueueService;
use calderawp\calderaforms\Tests\Integration\TestCase;
use WP_Queue\Queue;

class ContainerServicesAreLoadedTest extends TestCase
{

	protected $container;
	public function setUp()
	{
		$this->container = false;
		parent::setUp(); // TODO: Change the autogenerated stub
	}

	public function testDidAction(){
		$this->assertEquals( 1, did_action( 'caldera_forms_core_init'));
		$this->assertEquals( 1,did_action( 'caldera_forms_v2_init'));
	}

    /**
     * @since 1.8.0
     *
     * @covers \caldera_forms_v2_container_setup()
     */
	public function testHasQueueService(){
		$this->assertInstanceOf( Queue::class, caldera_forms_get_v2_container()->getService(QueueService::class) );
	}

    /**
     * @since 1.8.0
     *
     * @covers \caldera_forms_v2_container_setup()
     */
	public function testHasQueueSchedulerService(){
		$this->assertInstanceOf( Scheduler::class, caldera_forms_get_v2_container()->getService(QueueSchedulerService::class) );
	}

    /**
     * @since 1.8.10
    *
     * @covers \caldera_forms_v2_container_setup()
     */
    public function testHasFormsService()
    {
        $this->assertInstanceOf( FormCollection::class,
            caldera_forms_get_v2_container()
                ->getService(FormsService::class )
        );

    }

    /**
     * @since 1.8.10
     *
     * @group now
     * @covers \caldera_forms_v2_container_setup()
     */
    public function testHasProcessorService()
    {
        $this->assertInstanceOf( ProcessorFactory::class,
            caldera_forms_get_v2_container()
                ->getService(ProcessorService::class )
        );
    }
}
