Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support level label feature #284

Merged
merged 19 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename test to match new file, repo-meta-api.php.
  • Loading branch information
gudmdharalds committed Jul 4, 2022
commit 7b40c318c2cfb71e4ff949c7bb347966076ec8e7
205 changes: 205 additions & 0 deletions tests/integration/RepoMetaApiRepoMetaApiDataMatchTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
<?php

require_once( __DIR__ . '/IncludesForTests.php' );

use PHPUnit\Framework\TestCase;

final class SupportLevelLabelRepoMetaApiDataMatchTest extends TestCase {
var $options_meta_api_secrets = array(
'repo-meta-api-base-url' => null,
'repo-meta-api-user-id' => null,
'repo-meta-api-access-token' => null,

'repo-name' => null,
'repo-owner' => null,

'support-level' => null,
'support-level-field-name' => null,
);

protected function setUp(): void {
vipgoci_unittests_get_config_values(
'repo-meta-api-secrets',
$this->options_meta_api_secrets,
true
);

$this->options = $this->options_meta_api_secrets;

$this->options['data_match0'] = array(
);

$this->options['data_match1'] = array(
2 => array(
'__invalid_field' => array(
'__somethinginvalid'
),
),

3 => array(
'invalid_field_761a' => array(
'invalid_value',
)
)
);

$this->options['data_match2'] = array(
2 => array(
$this->options['support-level-field-name'] => array(
$this->options['support-level']
),
),

3 => array(
'invalid_field_761a' => array(
'invalid_value',
)
)
);

$this->options['branches-ignore'] = array();

// This can be an empty string, set to empty if null.
if ( null === $this->options['repo-meta-api-user-id'] ) {
$this->options['repo-meta-api-user-id'] = '';
}

// This can be an empty string, set to empty if null.
if ( null === $this->options['repo-meta-api-access-token'] ) {
$this->options['repo-meta-api-access-token'] = '';
}
}

protected function tearDown(): void {
$this->options = null;
$this->options_meta_api_secrets = null;
}

/**
* @covers ::vipgoci_repo_meta_api_data_match
*/
public function test_repo_meta_api_data_match1() {
$options_test = vipgoci_unittests_options_test(
$this->options,
array( 'repo-meta-api-user-id', 'repo-meta-api-access-token' ),
$this
);

if ( -1 === $options_test ) {
return;
}

$option_key_no = null;

$this->assertSame(
false,

vipgoci_repo_meta_api_data_match(
$this->options,
'',
$option_key_no
)
);

$this->assertSame(
null,
$option_key_no
);
}

/**
* @covers ::vipgoci_repo_meta_api_data_match
*/
public function test_repo_meta_api_data_match2() {
$options_test = vipgoci_unittests_options_test(
$this->options,
array( 'repo-meta-api-user-id', 'repo-meta-api-access-token' ),
$this
);

if ( -1 === $options_test ) {
return;
}

$option_key_no = null;

$this->assertSame(
false,

vipgoci_repo_meta_api_data_match(
$this->options,
'data_match0',
$option_key_no
)
);

$this->assertSame(
null,
$option_key_no
);
}

/**
* @covers ::vipgoci_repo_meta_api_data_match
*/
public function test_repo_meta_api_data_match3() {
$options_test = vipgoci_unittests_options_test(
$this->options,
array( 'repo-meta-api-user-id', 'repo-meta-api-access-token' ),
$this
);

if ( -1 === $options_test ) {
return;
}

$option_key_no = null;

$this->assertSame(
false,

vipgoci_repo_meta_api_data_match(
$this->options,
'data_match1',
$option_key_no
)
);

$this->assertSame(
null,
$option_key_no
);
}

/**
* @covers ::vipgoci_repo_meta_api_data_match
*/
public function test_repo_meta_api_data_match4() {
$options_test = vipgoci_unittests_options_test(
$this->options,
array( 'repo-meta-api-user-id', 'repo-meta-api-access-token' ),
$this
);

if ( -1 === $options_test ) {
return;
}

$option_key_no = null;

$this->assertSame(
true,

vipgoci_repo_meta_api_data_match(
$this->options,
'data_match2',
$option_key_no
)
);

$this->assertSame(
2,
$option_key_no
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PHPUnit\Framework\TestCase;

final class SupportLevelLabelRepoMetaApiDataMatchTest extends TestCase {
final class RepoMetaApiRepoMetaApiDataMatchTest extends TestCase {
var $options_meta_api_secrets = array(
'repo-meta-api-base-url' => null,
'repo-meta-api-user-id' => null,
Expand Down