diff --git a/init.php b/init.php index d9a968335d..377c187ba2 100644 --- a/init.php +++ b/init.php @@ -98,6 +98,8 @@ require(dirname(__FILE__) . '/lib/Recipient.php'); require(dirname(__FILE__) . '/lib/RecipientTransfer.php'); require(dirname(__FILE__) . '/lib/Refund.php'); +require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php'); +require(dirname(__FILE__) . '/lib/Reporting/ReportType.php'); require(dirname(__FILE__) . '/lib/SKU.php'); require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php'); require(dirname(__FILE__) . '/lib/Source.php'); diff --git a/lib/Reporting/ReportRun.php b/lib/Reporting/ReportRun.php new file mode 100644 index 0000000000..faf3167fe9 --- /dev/null +++ b/lib/Reporting/ReportRun.php @@ -0,0 +1,27 @@ + 'Stripe\\Recipient', \Stripe\RecipientTransfer::OBJECT_NAME => 'Stripe\\RecipientTransfer', \Stripe\Refund::OBJECT_NAME => 'Stripe\\Refund', + \Stripe\Reporting\ReportRun::OBJECT_NAME => 'Stripe\\Reporting\\ReportRun', + \Stripe\Reporting\ReportType::OBJECT_NAME => 'Stripe\\Reporting\\ReportType', \Stripe\SKU::OBJECT_NAME => 'Stripe\\SKU', \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => 'Stripe\\Sigma\\ScheduledQueryRun', \Stripe\Source::OBJECT_NAME => 'Stripe\\Source', diff --git a/tests/Stripe/Reporting/ReportRunTest.php b/tests/Stripe/Reporting/ReportRunTest.php new file mode 100644 index 0000000000..a78070405f --- /dev/null +++ b/tests/Stripe/Reporting/ReportRunTest.php @@ -0,0 +1,47 @@ + [ + "connected_account" => "acct_123" + ], + "report_type" => "activity.summary.1", + ]; + + $this->expectsRequest( + 'post', + '/v1/reporting/report_runs', + $params + ); + $resource = ReportRun::create($params); + $this->assertInstanceOf("Stripe\\Reporting\\ReportRun", $resource); + } + + public function testIsListable() + { + $this->expectsRequest( + 'get', + '/v1/reporting/report_runs' + ); + $resources = ReportRun::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Reporting\\ReportRun", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/reporting/report_runs/' . self::TEST_RESOURCE_ID + ); + $resource = ReportRun::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Reporting\\ReportRun", $resource); + } +} diff --git a/tests/Stripe/Reporting/ReportTypeTest.php b/tests/Stripe/Reporting/ReportTypeTest.php new file mode 100644 index 0000000000..d37778502f --- /dev/null +++ b/tests/Stripe/Reporting/ReportTypeTest.php @@ -0,0 +1,29 @@ +expectsRequest( + 'get', + '/v1/reporting/report_types' + ); + $resources = ReportType::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Reporting\\ReportType", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/reporting/report_types/' . self::TEST_RESOURCE_ID + ); + $resource = ReportType::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Reporting\\ReportType", $resource); + } +}