Ejemplo n.º 1
0
 public function setUp()
 {
     $this->exercise = $this->createMock(CgiExerciseInterface::class);
     $this->runner = new CgiRunner($this->exercise, new EventDispatcher(new ResultAggregator()));
     $this->exercise->expects($this->any())->method('getType')->will($this->returnValue(ExerciseType::CGI()));
     $this->assertEquals('CGI Program Runner', $this->runner->getName());
 }
 public function setUp()
 {
     $this->check = new PhpLintCheck();
     $this->exercise = $this->getMock(ExerciseInterface::class);
     $this->assertEquals('PHP Code Check', $this->check->getName());
     $this->assertEquals(ExerciseInterface::class, $this->check->getExerciseInterface());
     $this->assertTrue($this->check->canRun(ExerciseType::CGI()));
     $this->assertTrue($this->check->canRun(ExerciseType::CLI()));
 }
Ejemplo n.º 3
0
 public function setUp()
 {
     $this->check = new ComposerCheck();
     $this->exercise = new ComposerExercise();
     $this->assertEquals('Composer Dependency Check', $this->check->getName());
     $this->assertEquals(ComposerExerciseCheck::class, $this->check->getExerciseInterface());
     $this->assertTrue($this->check->canRun(ExerciseType::CGI()));
     $this->assertTrue($this->check->canRun(ExerciseType::CLI()));
 }
 public function testSupports()
 {
     $exercise1 = $this->prophesize(ExerciseInterface::class);
     $exercise2 = $this->prophesize(ExerciseInterface::class);
     $exercise1->getType()->willReturn(ExerciseType::CLI());
     $exercise2->getType()->willReturn(ExerciseType::CGI());
     $this->assertTrue($this->factory->supports($exercise1->reveal()));
     $this->assertFalse($this->factory->supports($exercise2->reveal()));
 }
Ejemplo n.º 5
0
 public function setUp()
 {
     $this->testDir = sprintf('%s/%s', sys_get_temp_dir(), $this->getName());
     mkdir($this->testDir, 0777, true);
     $this->check = new FileExistsCheck();
     $this->exercise = $this->getMock(ExerciseInterface::class);
     $this->assertEquals('File Exists Check', $this->check->getName());
     $this->assertEquals(ExerciseInterface::class, $this->check->getExerciseInterface());
     $this->assertTrue($this->check->canRun(ExerciseType::CGI()));
     $this->assertTrue($this->check->canRun(ExerciseType::CLI()));
 }
 public function setUp()
 {
     $parserFactory = new ParserFactory();
     $this->parser = $parserFactory->create(ParserFactory::PREFER_PHP7);
     $this->check = new FunctionRequirementsCheck($this->parser);
     $this->exercise = new FunctionRequirementsExercise();
     $this->assertEquals('Function Requirements Check', $this->check->getName());
     $this->assertEquals(FunctionRequirementsExerciseCheck::class, $this->check->getExerciseInterface());
     $this->assertTrue($this->check->canRun(ExerciseType::CGI()));
     $this->assertTrue($this->check->canRun(ExerciseType::CLI()));
 }
Ejemplo n.º 7
0
 public function setUp()
 {
     $this->check = new CodeParseCheck((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
     $this->assertEquals('Code Parse Check', $this->check->getName());
     $this->assertEquals(ExerciseInterface::class, $this->check->getExerciseInterface());
     $this->assertTrue($this->check->canRun(ExerciseType::CGI()));
     $this->assertTrue($this->check->canRun(ExerciseType::CLI()));
     $this->file = sprintf('%s/%s/submission.php', str_replace('\\', '/', sys_get_temp_dir()), $this->getName());
     mkdir(dirname($this->file), 0775, true);
     touch($this->file);
 }
Ejemplo n.º 8
0
 /**
  * @return ExerciseType
  */
 public function getType()
 {
     return ExerciseType::CGI();
 }