-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Saloodo/Adding-sf4-support-and-testing
Adding sf4 support and testing
- Loading branch information
Showing
4 changed files
with
140 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
language: php | ||
sudo: true | ||
php | ||
- 7.1 | ||
- 7.2 | ||
|
||
language: bash | ||
matrix: | ||
include: | ||
- php: 7.1 | ||
env: SYMFONY_VERSION='3.4.*' | ||
- php: 7.2 | ||
env: DEPENDENCIES='dev' SYMFONY_VERSION='3.4.*@dev' | ||
- php: 7.2 | ||
env: SYMFONY_VERSION='4.4.*@dev' | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
before_install: | ||
- composer self-update | ||
- if [ "$DEPENDENCIES" == "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; | ||
- if [ "$SYMFONY_VERSION" != "" ]; then composer --no-update require symfony/symfony:${SYMFONY_VERSION}; fi; | ||
|
||
script: | ||
- echo "something" | ||
- ls -al ~/.ssh/ | ||
install: composer update $COMPOSER_FLAGS | ||
|
||
script: vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
|
||
namespace Saloodo\Scheduler\Tests\Functional; | ||
|
||
|
||
use PHPUnit\Framework\TestCase; | ||
use Saloodo\Scheduler\Jobs\Mutex\JobLocker; | ||
use Saloodo\Scheduler\Jobs\Mutex\JobSymfonyLocker; | ||
use Saloodo\Scheduler\Jobs\Mutex\SchedulerLocker; | ||
use Saloodo\Scheduler\Jobs\Mutex\SchedulerSymfonyLocker; | ||
use Saloodo\Scheduler\Jobs\Scheduler; | ||
use Saloodo\Scheduler\Tests\SchedulerBundleKernel; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
class ServiceWiringTest extends TestCase | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
private $container; | ||
|
||
public function testSchedulerLockerServiceWiring(): void | ||
{ | ||
/** @var SchedulerLocker $schedulerLockerService */ | ||
$schedulerLockerService = $this->container->get(SchedulerLocker::class); | ||
|
||
self::assertInstanceOf(SchedulerLocker::class, $schedulerLockerService); | ||
} | ||
|
||
public function testSchedulerSymfonyLockerWiring(): void | ||
{ | ||
/** @var SchedulerSymfonyLocker $schedulerSymfonyLockerService */ | ||
$schedulerSymfonyLockerService = $this->container->get(SchedulerSymfonyLocker::class); | ||
|
||
self::assertInstanceOf(SchedulerSymfonyLocker::class, $schedulerSymfonyLockerService); | ||
} | ||
|
||
public function testJobLockerWiring(): void | ||
{ | ||
/** @var JobLocker $jobLocker */ | ||
$jobLocker = $this->container->get(JobLocker::class); | ||
|
||
self::assertInstanceOf(JobLocker::class, $jobLocker); | ||
} | ||
|
||
public function testJobSymfonyLockerWiring(): void | ||
{ | ||
/** @var JobLocker $jobSymfonyLocker */ | ||
$jobSymfonyLocker = $this->container->get(JobSymfonyLocker::class); | ||
|
||
self::assertInstanceOf(JobSymfonyLocker::class, $jobSymfonyLocker); | ||
} | ||
|
||
public function testSchedulerWiring(): void | ||
{ | ||
/** @var Scheduler $scheduler */ | ||
$scheduler = $this->container->get(Scheduler::class); | ||
|
||
self::assertInstanceOf(Scheduler::class, $scheduler); | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
$config = [ | ||
'cache_driver' => 'test_cache_driver', | ||
'cache_store' => 'test_cache_store' | ||
]; | ||
$kernel = new SchedulerBundleKernel($config); | ||
$kernel->boot(); | ||
$this->container = $kernel->getContainer(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
|
||
namespace Saloodo\Scheduler\Tests; | ||
|
||
|
||
use Saloodo\Scheduler\SchedulerBundle; | ||
use Symfony\Component\Cache\Adapter\FilesystemAdapter; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\EventDispatcher\EventDispatcher; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Lock\Store\FlockStore; | ||
|
||
class SchedulerBundleKernel extends Kernel | ||
{ | ||
|
||
private $saloodoSchedulerConfig; | ||
|
||
public function __construct(array $config = []) | ||
{ | ||
$this->saloodoSchedulerConfig = $config; | ||
parent::__construct('test', true); | ||
} | ||
|
||
public function registerBundles() | ||
{ | ||
return [ | ||
new SchedulerBundle() | ||
]; | ||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
$loader->load(function (ContainerBuilder $container) { | ||
$container->register('test_cache_driver', FilesystemAdapter::class); | ||
$container->register('test_cache_store', FlockStore::class); | ||
$container->register('event_dispatcher', EventDispatcher::class); | ||
$container->loadFromExtension('scheduler', $this->saloodoSchedulerConfig); | ||
}); | ||
} | ||
} |