public function testIfWillProperlyReadDocComment()
 {
     $class = new ReflectionClass(AbstractSettings::class);
     $doc = new \Maslosoft\Addendum\Builder\DocComment();
     $data = $doc->forClass($class);
     codecept_debug($data);
 }
 public function tryToTest(FunctionalTester $I)
 {
     $I->amOnPage('/');
     $I->see('Symfony Blog', 'title');
     $res = $I->dontSeeInRepository('AppBundle/User');
     codecept_debug($res);
 }
 public function testIfWillProperlyCreateAndSaveEmbedRefsFromPostData()
 {
     // POST data from real application
     $data = ['items' => [0 => ['title' => '', 'description' => '', 'hasText' => false, 'items' => [0 => ['filename' => '', 'file' => ['width' => 0, 'height' => 0, 'filename' => '', 'size' => 0, 'rootClass' => '', 'rootId' => '', 'contentType' => '', '_id' => '56336cccc79fda857b8b4b0e', '_key' => '', '_class' => 'Maslosoft\\Mangan\\Model\\Image', 'meta' => [], 'rawI18N' => []], 'basename' => '', 'relativeName' => '', 'icon' => '/css/filetypes/512/_blank.png', 'isImage' => false, 'iconSize' => 512, 'path' => '', 'url' => '/assets/get/56336cccc79fda857b8b4b06', 'type' => '', 'deleted' => false, 'title' => '', 'description' => '', 'id' => '56336cccc79fda857b8b4b06', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b06', '_key' => '56336ccbc79fda857b8b4b00', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\PageAsset', 'meta' => [], 'parentId' => NULL], 1 => ['filename' => '', 'file' => ['width' => 0, 'height' => 0, 'filename' => '', 'size' => 0, 'rootClass' => '', 'rootId' => '', 'contentType' => '', '_id' => '56336cccc79fda857b8b4b0f', '_key' => '', '_class' => 'Maslosoft\\Mangan\\Model\\Image', 'meta' => [], 'rawI18N' => []], 'basename' => '', 'relativeName' => '', 'icon' => '/css/filetypes/512/_blank.png', 'isImage' => false, 'iconSize' => 512, 'path' => '', 'url' => '/assets/get/56336cccc79fda857b8b4b08', 'type' => '', 'deleted' => false, 'title' => '', 'description' => '', 'id' => '56336cccc79fda857b8b4b08', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b08', '_key' => '56336cccc79fda857b8b4b01', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\PageAsset', 'meta' => [], 'parentId' => NULL], 2 => ['filename' => '', 'file' => ['width' => 0, 'height' => 0, 'filename' => '', 'size' => 0, 'rootClass' => '', 'rootId' => '', 'contentType' => '', '_id' => '56336cccc79fda857b8b4b10', '_key' => '', '_class' => 'Maslosoft\\Mangan\\Model\\Image', 'meta' => [], 'rawI18N' => []], 'basename' => '', 'relativeName' => '', 'icon' => '/css/filetypes/512/_blank.png', 'isImage' => false, 'iconSize' => 512, 'path' => '', 'url' => '/assets/get/56336cccc79fda857b8b4b0a', 'type' => '', 'deleted' => false, 'title' => '', 'description' => '', 'id' => '56336cccc79fda857b8b4b0a', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0a', '_key' => '56336cccc79fda857b8b4b02', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\PageAsset', 'meta' => [], 'parentId' => NULL]], 'assetsCount' => 0, 'id' => '56336cccc79fda857b8b4b0b', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0b', '_key' => '56336ccbc79fda857b8b4aff', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\AssetGroup', 'meta' => [], 'parentId' => ''], 1 => ['title' => 'Some title', 'description' => '', 'hasText' => true, 'items' => [], 'assetsCount' => 0, 'id' => '56336cccc79fda857b8b4b0c', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => 'Some title'], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0c', '_key' => '56336cccc79fda857b8b4b03', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\AssetGroup', 'meta' => [], 'parentId' => '']], 'title' => '', 'description' => '', 'groupCount' => 0, 'assetsCount' => 0, 'id' => '56336cccc79fda857b8b4b0d', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0d', '_key' => '56336ccbc79fda857b8b4afe', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\AssetCollection', 'meta' => []];
     $model = SafeArray::toModel($data);
     $handler = function (ModelEvent $event) {
         $event->isValid = true;
         codecept_debug('EntityManager::EventBeforeSave');
     };
     Event::on($model, EntityManager::EventBeforeSave, $handler);
     $this->assertTrue($model instanceof AssetCollection);
     $this->assertSame(2, count($model->items));
     $this->assertTrue($model->items[0] instanceof AssetGroup);
     $this->assertTrue($model->items[1] instanceof AssetGroup);
     $this->assertSame(3, count($model->items[0]->items));
     $this->assertTrue($model->items[0]->items[0] instanceof PageAsset);
     $this->assertTrue($model->items[0]->items[1] instanceof PageAsset);
     $this->assertTrue($model->items[0]->items[2] instanceof PageAsset);
     codecept_debug(get_class($model->items[0]));
     /* @var $model AssetCollection */
     $saved = $model->save();
     $this->assertTrue($saved);
     $found = $model->findByPk($model->id);
     $this->assertNotNull($found);
     $this->assertTrue($found instanceof AssetCollection);
     $this->assertSame(2, count($found->items));
     $this->assertTrue($found->items[0] instanceof AssetGroup);
 }
Example #4
0
 public function system($command, &$returnVar = null)
 {
     ob_start();
     $output = system($command, $returnVar);
     codecept_debug(static::class . " executed command:\n\t{$command}\nwith output:\n\t\$" . ob_get_clean());
     return $output;
 }
Example #5
0
 public function testRenderWithCache(IntegrationTester $I)
 {
     $I->wantToTest('Render by using simple view with cache');
     if (PHP_MAJOR_VERSION == 7) {
         throw new \PHPUnit_Framework_SkippedTestError('Skipped in view of the experimental support for PHP 7.');
     }
     // Create cache at first run
     $view = new Simple();
     codecept_debug(gettype($view->getParamsToView()));
     $view->setViewsDir(PATH_DATA . 'views/');
     // No cache before DI is set
     $I->assertFalse($view->getCache());
     $view->setDI($this->getDi());
     $I->assertEquals($view, $view->cache(['key' => 'view_simple_cache']));
     $cache = $view->getCache();
     $I->assertInstanceOf('Phalcon\\Cache\\BackendInterface', $cache);
     $timeNow = time();
     $view->setParamToView('a_cool_var', $timeNow);
     $I->assertEquals("<p>{$timeNow}</p>", rtrim($view->render('test3/coolVar')));
     $I->amInPath(PATH_CACHE);
     $I->seeFileFound('view_simple_cache');
     $I->seeInThisFile("<p>{$timeNow}</p>");
     unset($view, $cache);
     // Re-use the cached contents
     $view = new Simple();
     $view->setViewsDir(PATH_DATA . 'views/');
     $view->setDI($this->getDi());
     $view->cache(['key' => 'view_simple_cache']);
     $I->assertEmpty($view->getContent());
     $I->assertEquals("<p>{$timeNow}</p>", rtrim($view->render('test3/coolVar')));
     $I->assertNotEmpty($view->getContent());
     $I->assertEquals("<p></p>", rtrim($view->render('test3/coolVar')));
     $I->deleteFile('view_simple_cache');
 }
Example #6
0
 public function testIfWillResizeSavedImage()
 {
     // Temp file location
     $fileName = __DIR__ . '/logo-1024.png';
     $md5 = md5_file($fileName);
     $model = new ModelWithEmbeddedFile();
     $model->file = new Image();
     $model->file->set($fileName);
     $em = new EntityManager($model);
     $em->save();
     $finder = new Finder($model);
     $found = $finder->findByPk($model->_id);
     /* @var $found ModelWithEmbeddedFile */
     $file = $found->file->get()->getBytes();
     $this->assertSame($fileName, $found->file->filename);
     $this->assertSame($md5, md5($file));
     $image = $found->file;
     $params = new ImageParams();
     $params->width = 100;
     $params->height = 100;
     /* @var $image Image */
     $scaledName = tempnam('/tmp/', 'image-test') . '.png';
     $image->get($params)->write($scaledName);
     $this->assertTrue(file_exists($scaledName));
     $gd = new GD($scaledName);
     $dimensions = (object) $gd->getCurrentDimensions();
     codecept_debug($dimensions);
     $this->assertSame($params->width, $dimensions->width);
     $this->assertSame($params->height, $dimensions->height);
 }
Example #7
0
 protected function loadConfiguredGroupSettings()
 {
     foreach ($this->configuredGroups as $group => $tests) {
         $this->testsInGroups[$group] = [];
         if (is_array($tests)) {
             foreach ($tests as $test) {
                 $file = str_replace(['/', '\\'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $test);
                 $this->testsInGroups[$group][] = Configuration::projectDir() . $file;
             }
         } elseif (is_file(Configuration::projectDir() . $tests)) {
             $handle = @fopen(Configuration::projectDir() . $tests, "r");
             if ($handle) {
                 while (($test = fgets($handle, 4096)) !== false) {
                     // if the current line is blank then we need to move to the next line
                     // otherwise the current codeception directory becomes part of the group
                     // which causes every single test to run
                     if (trim($test) === '') {
                         continue;
                     }
                     $file = trim(Configuration::projectDir() . $test);
                     $file = str_replace(['/', '\\'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $file);
                     $this->testsInGroups[$group][] = $file;
                 }
                 fclose($handle);
             }
         } else {
             codecept_debug("Group '{$group}' is empty, no tests are loaded");
         }
     }
 }
 /**
  * @dataProvider values
  * @param $operator
  * @param $result
  * @param $expression
  */
 public function testToString($operator, $result, $expression)
 {
     $operator = new Parentheses($operator);
     expect("expression " . $expression, $operator->render())->equals($expression);
     expect("expression " . $expression, (string) $operator)->equals($expression);
     codecept_debug($operator->render());
 }
Example #9
0
 /**
  * @param $expr
  * @param $result
  * @param $expected
  * @dataProvider values
  */
 public function testRender($expr, $result, $expected)
 {
     codecept_debug($expr);
     $this->expression->fromString($expr, new Formula(new Lexer()));
     expect("render expression {$expected}", $this->expression->render())->equals($expected);
     codecept_debug($this->expression->render());
 }
Example #10
0
 /**
  * @inheritdoc
  */
 public function _initialize()
 {
     // compute datbase info
     $match = preg_match("/host=(.*);dbname=(.*)/", env("DB_DSN"), $matches);
     if (!$match) {
         return;
     }
     $host = $matches[1];
     $name = $matches[2] . "_test";
     $user = env("DB_USER");
     $pass = env("DB_PASS");
     // compute dump file
     $dumpFile = $this->config['dump'] ?: "tests/_data/dump.sql";
     $dumpFile = Configuration::projectDir() . $dumpFile;
     if (!file_exists($dumpFile)) {
         throw new ModuleException(__CLASS__, "Dump file does not exist [ {$dumpFile} ]");
     }
     // dump
     $cmd = "mysql -h {$host} -u {$user} -p{$pass} {$name} < {$dumpFile}";
     $start = microtime(true);
     $output = shell_exec($cmd);
     $end = microtime(true);
     $diff = round(($end - $start) * 1000, 2);
     // output debug info
     $className = get_called_class();
     codecept_debug("{$className} - Importing db [ {$name} ] [ {$diff} ms ]");
     // check for error
     if ($output) {
         throw new ModuleException(__CLASS__, "Failed to import db [ {$cmd} ]");
     }
 }
Example #11
0
 public function testIfWillProperlyCacheNamespacesForDifferentMetaContainers()
 {
     $path = (new ConfigDetector())->getRuntimePath();
     if (!is_dir($path)) {
         mkdir($path);
     }
     // Simulate different meta container classes by creating different paths
     $path1 = sprintf('%s/path1', $path);
     $path2 = sprintf('%s/path2', $path);
     $path3 = sprintf('%s/path3', $path);
     if (!is_dir($path1)) {
         mkdir($path1);
     }
     if (!is_dir($path2)) {
         mkdir($path2);
     }
     if (!is_dir($path3)) {
         mkdir($path3);
     }
     $ns1 = new NsCache($path1, Addendum::fly(), new CacheOptionsOne());
     $ns1->set();
     codecept_debug($ns1->get());
     $this->assertTrue($ns1->valid());
     $ns2 = new NsCache($path2, Addendum::fly(), new CacheOptionsTwo());
     $ns2->set();
     codecept_debug($ns2->get());
     $this->assertTrue($ns1->valid());
     $this->assertTrue($ns2->valid());
     $ns3 = new NsCache($path3, Addendum::fly(), new CacheOptionsOne());
     $ns3->set();
     codecept_debug($ns3->get());
     $this->assertTrue($ns1->valid());
     $this->assertTrue($ns2->valid());
     $this->assertTrue($ns3->valid());
 }
Example #12
0
 public function testImageComparer(FunctionalTester $I)
 {
     $I->amInPath($this->workDir);
     copy(codecept_data_dir() . 'image1.png', $this->workDir . '/image1.png');
     copy(codecept_data_dir() . 'image2.png', $this->workDir . '/image2.png');
     copy(codecept_data_dir() . 'image3.png', $this->workDir . '/image3.png');
     $comparer = new ImageComparer();
     // Check difference between the same image.
     $difference = $comparer->difference('image1.png', 'image1.png', 'image.diff.png');
     $I->assertTrue($difference === 0);
     $I->assertTrue(file_exists('image.diff.png'));
     unlink('image.diff.png');
     // Compare different images.
     $difference = $comparer->difference('image1.png', 'image2.png', 'image.diff.png');
     $I->assertTrue($difference > 0);
     codecept_debug($difference);
     $I->assertTrue(file_exists('image.diff.png'));
     // Compare different sized images.
     $difference = $comparer->difference('image1.png', 'image3.png', 'image.diff.png');
     $I->assertTrue($difference > 0);
     codecept_debug($difference);
     $I->assertTrue(file_exists('image.diff.png'));
     // Check missing command.
     $comparer->setCommand('this_command_doesnt_exist');
     try {
         $difference = $comparer->difference('image1.png', 'image2.png', 'image.diff.png');
         $I->fail("Bad command didn't throw an Exception");
     } catch (Exception $e) {
         // All good.
     }
 }
Example #13
0
 public function updateActor(SuiteEvent $e)
 {
     $settings = $e->getSettings();
     $modules = $e->getSuite()->getModules();
     $actorActionsFile = Configuration::supportDir() . '_generated' . DIRECTORY_SEPARATOR . $settings['class_name'] . 'Actions.php';
     if (!file_exists($actorActionsFile)) {
         codecept_debug("Generating {$settings['class_name']}Actions...");
         $this->generateActorActions($actorActionsFile, $settings);
         return;
     }
     // load actor class to see hash
     $handle = @fopen($actorActionsFile, "r");
     if ($handle and is_writable($actorActionsFile)) {
         $line = @fgets($handle);
         if (preg_match('~\\[STAMP\\] ([a-f0-9]*)~', $line, $matches)) {
             $hash = $matches[1];
             $currentHash = Actions::genHash($modules, $settings);
             // regenerate actor class when hashes do not match
             if ($hash != $currentHash) {
                 codecept_debug("Rebuilding {$settings['class_name']}...");
                 @fclose($handle);
                 $this->generateActorActions($actorActionsFile, $settings);
                 return;
             }
         }
         @fclose($handle);
     }
 }
 public function testGetQuoteFromWebServiceX()
 {
     $client = new \ITMH\Soap\Client('http://www.webservicex.net/StockQuote.asmx?WSDL', []);
     $result = $client->GetQuote(['symbol' => 'USD']);
     codecept_debug($result);
     self::assertTrue($result !== false);
 }
 public function testLoadFunc()
 {
     $this->funcInjector->save();
     codecept_debug($this->funcInjector->getFileName());
     $this->funcInjector->inject();
     verify(strlen('hello'))->equals(5);
 }
 /**
  * @depends create
  * @param ApiTester $I
  */
 public function getListDefault(ApiTester $I)
 {
     $resp = $I->successfullyGetList($this->restUrl, []);
     $list = $resp['data'];
     codecept_debug($list);
     $totRec = $resp['state']['totalRecords'];
     $I->assertEquals(20, $resp['state']['totalRecords']);
 }
Example #17
0
 /**
  * preberi vse zapise od osebe
  * 
  * @depends create
  * @param ApiTester $I
  */
 public function getList(ApiTester $I)
 {
     $resp = $I->successfullyGetList($this->restUrl, []);
     $list = $resp['data'];
     codecept_debug($resp);
     $totRec = $resp['state']['totalRecords'];
     codecept_debug($totRec);
     $I->assertGreaterThanOrEqual(2, $resp['state']['totalRecords']);
 }
Example #18
0
 /**
  * IMPORTANT NOTE: This is just a demo and it is not the most common use-case for the CtrlC module.
  * The benefits of this module can be enjoyed just by adding it to the list of enabled modules, in the config.
  *
  * @param AcceptanceTester $I
  */
 public function demo(AcceptanceTester $I)
 {
     $seconds = 60;
     $I->amGoingTo('loop for one minute; press Ctrl+C to abort');
     while (--$seconds > 0 && $I->amNotInterrupted()) {
         sleep(1);
         codecept_debug('...');
     }
 }
Example #19
0
 public function testIfWillReadProperDates()
 {
     $sanitizer = new DateWriteEsSanitizer();
     $date = $sanitizer->read(null, '2016-08-03T13:28:14+00:00');
     $this->assertInstanceof(MongoDate::class, $date);
     // NOTE: Just check date, as TZ might be different
     $this->assertSame('2016-08-03', date('Y-m-d', $date->sec));
     codecept_debug(date('c', $date->sec));
 }
Example #20
0
 public function testUrlNotValid()
 {
     $validator = new UrlValidator();
     $model = new BaseAttributesAnnotations();
     $model->string = 'http:///example.com/';
     $valid = $validator->isValid($model, 'string');
     $this->assertFalse($valid);
     $msg = sprintf('Validator messages: %s', implode(PHP_EOL, $validator->getErrors()));
     codecept_debug($msg);
 }
Example #21
0
 public function testIfWillValidateDbRefArrayOfDocumentsAndSkipNotUpdatableModels()
 {
     $model = new ModelWithDbRefArrayWithValidatorNotUpdatable();
     $model->addresses[] = new EmbeddedModelWithValidator();
     $model->addresses[] = new EmbeddedModelWithValidator();
     $validator = new Validator($model);
     $result = $validator->validate();
     codecept_debug($validator->getErrors());
     // Should pass even when adress is not valid
     $this->assertTrue($result, 'That validation passed, even if db refs are not valid, as they are not updatable');
 }
Example #22
0
 public function testIfWillThrowExceptionOnClassNotImportedSanitizer()
 {
     $model = new ModelWithNonExistentSanitizer2();
     try {
         ManganMeta::create($model);
         $this->fail('Exception was not thrown');
     } catch (UnexpectedValueException $exc) {
         codecept_debug($exc->getMessage());
         $this->assertTrue(true, 'That exception was thrown');
     }
 }
 public function testIfWillProperlyGetMetaFromNestedTrait()
 {
     $model = new ModelWithNestedTraits();
     $meta = Meta::create($model);
     $hasLabelMeta = $meta->hasLabel;
     $parentMeta = $meta->parentId;
     codecept_debug($hasLabelMeta);
     codecept_debug($parentMeta);
     $this->assertTrue(!empty($hasLabelMeta->label), 'That @Label is properly configured');
     $this->assertTrue(!empty($parentMeta->label), 'That @Label is detected on nested trait');
 }
Example #24
0
 public function delete(UnitTester $I)
 {
     $I->wantTo('Delete from cache by using Memory as cache backend');
     $key = 'data-delete';
     $cache = new Memory(new Data(['lifetime' => 20]));
     $I->assertNull($I->getProtectedProperty($cache, '_data'));
     $I->setProtectedProperty($cache, '_data', [$key => 100]);
     $I->assertTrue($cache->delete($key));
     //$I->assertNull($I->getProtectedProperty($cache, '_data'));
     codecept_debug($I->getProtectedProperty($cache, '_data'));
     $I->assertFalse($cache->delete($key));
 }
Example #25
0
 public function testIfWillValidateBooleanValueWithCustomGenericMessage()
 {
     $validator = new BooleanValidator();
     $validator->message = 'Error Generic';
     $model = new BaseAttributesAnnotations();
     $model->bool = 'bogus value';
     $valid = $validator->isValid($model, 'bool');
     $this->assertFalse($valid);
     $this->assertSame('Error Generic', $validator->getErrors()[0]);
     $msg = sprintf('Validator messages: %s', implode(PHP_EOL, $validator->getErrors()));
     \codecept_debug($msg);
 }
Example #26
0
 /**
  * 
  * @param ApiTester $I
  */
 public function lookupAlternacija(ApiTester $I)
 {
     // alternacija brez pogodbe
     $resp = $I->successfullyGetList($this->lookupAlternacijaUrl . '?ident=0003', []);
     $I->assertNotEmpty($resp);
     codecept_debug($resp);
     $I->assertTrue(array_key_exists('data', $resp), "ima data");
     $I->assertTrue(array_key_exists('label', $resp['data'][0]), "ima labelo");
     $I->assertTrue(array_key_exists('totalRecords', $resp['state']), "ima total records");
     $I->assertEquals(1, $resp['state']['totalRecords'], "total records");
     $this->lookAlternacija1 = $resp['data'][0];
 }
Example #27
0
 public function testCreateGetPaymentRequest()
 {
     $res = $this->client->createPaymentRequest($this->paymentRequest);
     codecept_debug($res->getStatusCode());
     codecept_debug($res->getHeaders());
     $this->assertEquals(201, $res->getStatusCode());
     $id = Util::getPaymentRequestIdFromResponse($res);
     $res = $this->client->getPaymentRequest($id);
     $body = Util::decodeResponse($res);
     codecept_debug($body);
     $this->assertEquals($id, $body['id']);
 }
Example #28
0
 public function testNotRegexNotValid()
 {
     $validator = new RegexValidator();
     $validator->not = true;
     $validator->pattern = '~^[a-z]{4}$~';
     $model = new BaseAttributesAnnotations();
     $model->string = 'abcd';
     $valid = $validator->isValid($model, 'string');
     $this->assertFalse($valid);
     $msg = sprintf('Validator messages: %s', implode(PHP_EOL, $validator->getErrors()));
     codecept_debug($msg);
 }
Example #29
0
 public function testIgnoreAnnotationsSurroundedByFenceWhenRawAnnotateIsUsed()
 {
     $model = new ModelWithFences();
     $file = (new ReflectionObject($model))->getFileName();
     $annotations = AnnotationUtility::rawAnnotate($file);
     $this->assertTrue(!empty($annotations['class']), 'That has class annotations are present');
     codecept_debug($annotations['class']);
     $this->assertTrue(!empty($annotations['class']['Label']), 'That has @Label annotation is present');
     $this->assertTrue(!empty($annotations['class']['Label'][0]['value']), 'That has @Label has value');
     $this->assertSame('LABEL', $annotations['class']['Label'][0]['value'], 'That @Label has proper value');
     $this->assertFalse(array_key_exists('Description', $annotations['class']), 'That @Description was ignored');
 }
Example #30
0
 public function testNotRangeNotValid()
 {
     $validator = new RangeValidator();
     $validator->range = [1, 2, 3];
     $validator->not = true;
     $model = new BaseAttributesAnnotations();
     $model->int = 1;
     $valid = $validator->isValid($model, 'int');
     $this->assertFalse($valid);
     $msg = sprintf('Validator messages: %s', implode(PHP_EOL, $validator->getErrors()));
     codecept_debug($msg);
 }