예제 #1
0
 /**
  * @test
  * it should alter the users table
  */
 public function it_should_alter_the_user_table(FunctionalTester $I)
 {
     $first = $I->haveMultisiteInDatabase();
     $second = $I->haveMultisiteInDatabase();
     foreach ($second as $table => $output) {
         $I->assertEquals('alter', $output['operation']);
         $I->assertEquals($table == 'users', $output['exit']);
     }
 }
 public function returnExistingCharges(FunctionalTester $I)
 {
     $repo = app('\\BB\\Repo\\SubscriptionChargeRepository');
     /** @var \BB\Repo\SubscriptionChargeRepository $repo */
     $userId = 23;
     $amount = rand(5, 30);
     $chargeDate1 = Carbon::now()->subMonth();
     $chargeDate2 = Carbon::now();
     $repo->createCharge($userId, $chargeDate1, $amount);
     $repo->createCharge($userId, $chargeDate2, $amount);
     $charges = $repo->getMemberCharges($userId);
     $I->assertEquals(2, $charges->count());
     $I->assertEquals($amount, $charges->first()->amount);
     $I->assertEquals($chargeDate2->setTime(0, 0, 0), $charges->first()->charge_date);
 }
예제 #3
0
 public function ResponseOfInvalidSource(Tester $I)
 {
     $I->wantToTest('response if we provide an Invalid Source');
     $I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
     $I->sendGET("currenttime", ["source" => 'airfares']);
     //Not matching the API Key
     $I->assertEquals(json_decode('{"code": "2","message":"Invalid source."}'), json_decode($I->grabResponse()));
 }
예제 #4
0
 /**
  * @test
  * it should allow inserting many posts and return an array of ids
  */
 public function it_should_allow_inserting_many_posts_and_return_an_array_of_ids(FunctionalTester $I)
 {
     $ids = $I->haveManyPostsInDatabase(5);
     $I->assertEquals(5, count(array_unique($ids)));
     array_map(function ($id) use($I) {
         $I->assertTrue(is_int($id));
     }, $ids);
 }
 /**
  * Confirm sub charge records can be created and fetched
  *
  * @param FunctionalTester $I
  */
 public function testSubChargeFetching(FunctionalTester $I)
 {
     $subChargeRepo = App::make('\\BB\\Repo\\SubscriptionChargeRepository');
     $subChargeRepo->createCharge(10, Carbon::now());
     $charge = $subChargeRepo->findCharge(10);
     $I->assertNotNull($charge);
     $I->assertEquals(10, $charge->user_id);
 }
 /**
  * @test
  * it should allow getting non blog id prefixed table names for main blog
  */
 public function it_should_allow_getting_non_blog_id_prefixed_table_names_for_main_blog(FunctionalTester $I)
 {
     $tables = ['commentmeta', 'comments', 'links', 'options', 'postmeta', 'posts', 'term_relationships', 'term_taxonomy', 'terms', 'termmeta'];
     foreach ($tables as $table) {
         $I->useMainBlog();
         $tableName = $I->grabPrefixedTableNameFor($table);
         $I->assertEquals($I->grabTablePrefix() . $table, $tableName);
     }
 }
예제 #7
0
 /**
  * @test
  * it should allow having many comments with number placeholder
  */
 public function it_should_allow_having_many_comments_with_number_placeholder(FunctionalTester $I)
 {
     $postId = $I->havePostInDatabase();
     $overrides = ['comment_author' => 'Luca', 'comment_author_email' => '*****@*****.**', 'comment_author_url' => 'https://theaveragedev.com', 'comment_author_IP' => '111.222.333.444', 'comment_date' => Date::now(), 'comment_date_gmt' => Date::gmtNow(), 'comment_content' => "No comment", 'comment_karma' => '3', 'comment_approved' => '0', 'comment_agent' => 'some agent', 'comment_type' => 'status', 'comment_parent' => 23, 'user_id' => 12];
     $ids = $I->haveManyCommentsInDatabase(5, $postId, $overrides);
     $I->assertEquals(5, count($ids));
     for ($i = 0; $i < count($ids); $i++) {
         foreach ($overrides as $key => $value) {
             $I->seeInDatabase($I->grabCommentsTableName(), ['comment_post_ID' => $postId, 'comment_ID' => $ids[$i], $key => str_replace('{{n}}', $i, $value)]);
         }
     }
 }
예제 #8
0
 /**
  * Checks that the minimum password requirement is working as expected (IS-21).
  *
  * @param FunctionalTester $I
  */
 public function testTheMinimumPasswordLength(FunctionalTester $I)
 {
     // assert that the property exists
     $I->assertTrue(isset(Yii::$app->user->minPasswordLength));
     // assert that the default value of the property is 6
     $I->assertEquals(6, Yii::$app->user->minPasswordLength);
     // try to register a user with a shorter password
     $registerPage = RegisterPage::openBy($I);
     $registerPage->register(Commons::TEST_EMAIL, '12345');
     // it must fail
     $I->see('Password should contain at least 6 characters.');
     $I->dontSeeRecord(User::className(), ['email' => Commons::TEST_EMAIL]);
     // try to register a user with a correct password length
     $registerPage->register(Commons::TEST_EMAIL, 'Innologica!23');
     // it must pass
     $I->seeRecord(User::className(), ['email' => Commons::TEST_EMAIL]);
 }
예제 #9
0
<?php

$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$items = $rabman->nodes()->columns(['exchange_types.name']);
$count = count($items);
$I->assertTrue($count > 0);
$expected = [['name' => 'direct'], ['name' => 'headers'], ['name' => 'topic'], ['name' => 'fanout']];
$I->assertEquals($expected, $items[0]['exchange_types']);
<?php

$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$items = $rabman->extensions();
$count = count($items);
$I->assertTrue($count > 0);
$expected = ['javascript' => 'dispatcher.js'];
$I->assertEquals($expected, $items[0]);
예제 #11
0
 /**
  * @test
  * it should allow grabbing a site transient while using secondary blog
  */
 public function it_should_allow_grabbing_a_site_transient_while_using_secondary_blog(FunctionalTester $I)
 {
     $table = $I->grabPrefixedTableNameFor('options');
     $I->haveInDatabase($table, ['option_name' => '_site_transient_key', 'option_value' => 'foo']);
     $I->useBlog(2);
     $value = $I->grabSiteTransientFromDatabase('key');
     $I->assertEquals('foo', $value);
 }
    public function testGetConceptPropertiesArray(FunctionalTester $I)
    {
        $concept = ConceptPeer::retrieveByPK(727);
        $propertyArray = jsonldService::getConceptPropertyArray($concept);
        $I->assertEquals(json_encode($propertyArray,
                                     JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), '{
    "@id": "http://rdaregistry.info/termList/AspectRatio/1001",
    "@type": "Concept",
    "api": "http://api.metadataregistry.org/concepts/727",
    "inScheme": "http://rdaregistry.info/termList/AspectRatio/",
    "status": "Published",
    "prefLabel": {
        "en": "full screen",
        "de": "Vollbild",
        "fr": "plein écran",
        "es": "pantalla completa",
        "zh": "全屏"
    },
    "scopeNote": {
        "en": "Use for standard format, i.e., 1.33:1 or 4:3."
    },
    "definition": {
        "en": "Aspect ratio for a moving image resource of less than 1.5:1.",
        "de": "Bildformat einer Bewegtbildressource von weniger als 1.5:1.",
        "fr": "Format de l’image d’une ressource d’images animées inférieur à 1,5:1.",
        "es": "Proporción dimensional de un recurso de imagen en movimiento menor que 1.5:1.",
        "zh": "动态图像资源的宽高比小于1.5:1。"
    },
    "ToolkitLabel": {
        "en": "full screen",
        "fr": "plein écran",
        "de": "Vollbild",
        "es": "pantalla completa",
        "zh": "全屏"
    },
    "ToolkitDefinition": {
        "en": "Aspect ratio for a moving image resource of less than 1.5:1.",
        "fr": "Format de l’image d’une ressource d’images animées inférieur à 1,5:1.",
        "de": "Bildformat einer Bewegtbildressource von weniger als 1.5:1.",
        "es": "Proporción dimensional de un recurso de imagen en movimiento menor que 1.5:1.",
        "zh": "动态图像资源的宽高比小于1.5:1。"
    },
    "altLabel": {
        "en": [
            "full-screen",
            "full-screen",
            "fullscreen",
            "full-screen"
        ]
    }
}');
    }
예제 #13
0
 /**
  * @test
  * it should allow grabbing a user unique meta
  */
 public function it_should_allow_grabbing_a_user_unique_meta(FunctionalTester $I)
 {
     $I->haveUserInDatabase('Luca');
     $userId = $I->grabUserIdFromDatabase('Luca');
     $I->haveUserMetaInDatabase($userId, 'some_key', 'some_value');
     $meta = $I->grabUserMetaFromDatabase($userId, 'some_key');
     $I->assertEquals(1, count($meta));
     $I->assertEquals('some_value', $meta[0]);
 }
<?php

$fixture = (require 'fixtures/definition.php');
$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$items = $rabman->definitions();
$count = count($items);
$I->assertTrue($count > 0);
$rabman->definitions()->vhost()->create(json_decode($fixture, true));
$items = $rabman->exchanges('second.exchange.5')->columns(['name']);
count($items);
$I->assertTrue($count > 0);
$I->assertEquals('second.exchange.5', $items[0]['name']);
 public function redirectUrl(FunctionalTester $I)
 {
     $port = $I->openProxy();
     $I->assertNotNull($port, "`{$port}` is not a valid port");
     $rep = $I->redirectUrl('http://testdomain.url/', 'http://codeception.com/');
     $I->assertTrue($rep);
     $I->startHar('codeception');
     Requests::get('http://testdomain.url/', [], ['proxy' => "127.0.0.1:{$port}"]);
     $har = $I->getHar();
     $I->assertEquals('http://codeception.com/', $har['log']['entries'][0]['request']['url']);
     $I->closeProxy();
 }
예제 #16
0
<?php

$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$rabman->cluster()->create(['name' => 'rabbit@my-rabbit']);
$items = $rabman->cluster();
$count = count($items);
$I->assertTrue($count > 0);
$I->assertEquals('rabbit@my-rabbit', $items[0]['name']);
$rabman->cluster()->create(['name' => 'rabbit@not-my-rabbit']);
$items = $rabman->cluster();
$count = count($items);
$I->assertTrue($count > 0);
$I->assertEquals('rabbit@not-my-rabbit', $items[0]['name']);
 public function canFetchPhoto(FunctionalTester $I)
 {
     $I->am('a developer');
     $I->wantTo('ensure photos can be fetched');
     $equipment = \BB\Entities\Equipment::findOrFail(2);
     $equipment->addPhoto('foo.png');
     $equipment = \BB\Entities\Equipment::findOrFail(2);
     $I->assertEquals($equipment->getPhotoBasePath() . 'foo.png', $equipment->getPhotoPath(0));
 }
예제 #18
0
<?php

$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$items = $rabman->overview()->columns(['management_version']);
$count = count($items);
$I->assertTrue($count > 0);
$I->assertEquals('3.6.1', $items[0]['management_version']);
<?php

$I = new FunctionalTester($scenario);
$I->wantTo('I want to load SymphonyCMSDb Module');
$I->assertEquals($I->symphonyCMSDBTest(), 'Hello World');
$I->assertNotNull(\EntryManager::create());
예제 #20
0
<?php

$I = new FunctionalTester($scenario);
$I->wantTo('flush old devices');
$piOne = ['ip' => '192.168.1.101', 'mac' => '11:22:33:44:55:66', 'name' => 'Awesome Pi One', 'created_at' => (new \Carbon\Carbon())->subHour()->toDateTimeString(), 'updated_at' => (new \Carbon\Carbon())->subHour()->toDateTimeString()];
$I->haveRecord('devices', $piOne);
$piTwo = ['ip' => '192.168.1.102', 'mac' => '11:22:33:44:55:67', 'name' => 'Awesome Pi Two', 'created_at' => (new \Carbon\Carbon())->subHour()->toDateTimeString(), 'updated_at' => (new \Carbon\Carbon())->now()->toDateTimeString()];
$I->haveRecord('devices', $piTwo);
$I->assertEquals(2, \PiFinder\Device::count());
$I->runConsoleCommand('pi:flush');
$I->assertEquals(1, \PiFinder\Device::count());
$I->dontSeeRecord('devices', $piOne);
$I->seeRecord('devices', $piTwo);
 /**
  * @dataprovider __myDataSource
  */
 public function withExampleProvider(FunctionalTester $I, Example $example)
 {
     $expected = ["", "foo", "bar", "re"];
     $I->assertInternalType('integer', $example[0]);
     $I->assertEquals($expected[$example[0]], $example[1]);
 }